npx ui8kit@3 init --yes --framework react --dir src && npx ui8kit@3 add button # or: add --allFiles land in {dir}/ui/<brick>/<brick>.tsx (+ <brick>.shared.ts), helpers in {dir}/utils
(cn = clsx + tailwind-merge; peers clsx, tailwind-merge are added to package.json).
- Declared props are camelCase (
htmlFor,readOnly,srcSet);classisclassName; ARIA stays hyphenated (aria-label). Undeclared props (id,data-*,onClick, …) flow through rest and win. - Children: regular
children(ReactNode). asChild(Box, Text, Button): merges the primitive's props/classes onto its single child via Slot — React only.
React is the reference the other targets are compared to (together with the canonical renderer). Known React-specific behaviour:
- A blank optional attribute (
id="",href="",aria-describedby=" ", …) is omitted — props and rest alike (safeRest); onlyvalue=""is printed, so a controlled<Input value="">stays controlled (see contract). - Select:
valuebecomesvaluewhen you passonChange, otherwisedefaultValue. - Controlled
checkedwithoutonChangetriggers React's read-only warning — passonChangeorreadOnlyin apps.
<name>Classes(input) from <brick>.shared.ts composes the class contract without rendering
(e.g. iconClasses({ size: "md", className })).
See also: contract · docs index · primitive pages in primitives/.