Skip to content

package shared attrs

GitHub Actions edited this page Sep 17, 2026 · 1 revision

package/shared-attrs

Import: import { renderAttrs, classAttrs } from "@tundralibs/ui/shared/attrs"

Functions

renderAttrs

renderAttrs(attrs: Attrs): Html

classAttrs

classAttrs(className: string | "false" | undefined, attrs: Attrs | undefined, arg: (string | "false" | undefined)[]): Html

Merge a caller's attrs.class into a component's own class list and render the rest. A second class attribute is silently discarded by the HTML parser, so every component that accepts attrs renders its root with this instead of class="…"${renderAttrs(attrs)}.

Types

Attrs

Root-element attributes for a component: values are escaped normally through html; undefined entries are dropped (so optional props can flow straight in without callers filtering them out first).

type Attrs = Record

Clone this wiki locally