Design system / Atoms
CreativeXHub design system
Atoms
Small controls and display elements: supported props, theme dependencies, consumer responsibilities and current examples.
Focused contracts, explicit consumers
An atom is a small, product-neutral control or display element with a focused API. This page documents Button, Input, Badge and Label in detail and shows other controls and small compound assemblies. A file in components/ui is not necessarily an atom: classify its responsibility, not its folder or source supplier.
Button
Variant, size, asChild and native button props. Product commands stay with the consumer.
Current component with fictional data. Example changes are not persisted.
These actions intentionally have no business command. Icon-only controls need accessible names. Button variants also style links through buttonVariants.
Button renders a native action control with shared variants, sizes and interaction styles. The caller supplies the accessible name, command and availability. With asChild, it applies that contract to a supplied element instead.
Supported inputs
| Input | Default / ownership | What it does |
|---|---|---|
| variant | default | Choose default, destructive, outline, secondary, ghost or link. This changes appearance, not permission or confirmation behavior. |
| size | default | Choose default, xs, sm, lg, icon, icon-xs, icon-sm or icon-lg. Give icon-only buttons a name that explains the action. |
| asChild | false | Apply Button's styling and props to a child instead of adding another button element. A link remains a link. |
| className | optional | Adjust a particular use. Overrides may prevent that use from picking up a later shared style change. |
| Native button props | forwarded | Includes disabled, onClick, type and aria-* attributes. Use type=button for actions that should not submit a surrounding form. |
Theme and style dependencies
| Token / utility | What it contributes |
|---|---|
| bg-primary / text-primary-foreground | Primary action background and its paired text color. |
| bg-secondary / text-secondary-foreground | A quieter action treatment with its own text pairing. |
| bg-accent / text-accent-foreground | Hover feedback for outline and ghost treatments. |
| bg-destructive / text-white | Destructive treatment currently uses literal white text, not the destructive-foreground token. |
| focus-visible:ring-ring / border-ring | The visible keyboard-focus indicator. |
| text-md / text-xs; rounded-md; h-9 / px-4 | The real fluid type scale, radius mapping and spacing multiplier supply the geometry. |
Example binding
<Button type="button" variant="outline" size="sm" onClick={onContinue}>
Continue
</Button>A real use: FieldInfo inside LabelWithInfo
The help icon uses a ghost Button at icon-xs size. Its accessible name is More info. A change to ghost-button focus styling reaches this help trigger; changing only the default variant does not.
src/components/ui/field-label.tsxWhere to change it
Change buttonVariants for shared appearance, sizes or variants. Change Button itself for structure and prop handling. Keep labels and click commands in the screen using it. The exported buttonVariants helper also styles links, so its reach is wider than Button's markup.
Input
Native input props. Value, label association, validation and help are consumer-owned.
Current component with fictional data. Example changes are not persisted.
Consumer-supplied error message.
Input renders a native input element and forwards its standard attributes. The caller supplies type, value ownership, a label and validation feedback. Input does not define field meaning or product validation rules.
Supported inputs
| Input | Default / ownership | What it does |
|---|---|---|
| type | native text default | Choose a suitable native input type, such as text or email. |
| value / defaultValue / onChange | native props | Either supply the current value and a change handler, or let the browser manage an initial value. |
| id | consumer supplied | Match this ID with the label's htmlFor so clicking the label focuses the field. |
| disabled / aria-invalid / aria-describedby | forwarded | Describe availability, indicate invalid input and connect help or error text. These attributes do not implement validation. |
| className | optional | Merged with shared styles for a specific use. |
Theme and style dependencies
| Token / utility | What it contributes |
|---|---|
| border-input / placeholder:text-muted-foreground | The entry boundary and placeholder appearance. |
| selection:bg-primary / selection:text-primary-foreground | The selected-text color pairing. |
| focus-visible:border-ring / ring-ring | Keyboard focus styling. |
| aria-invalid:border-destructive / ring-destructive | Appearance when the surrounding form marks the value invalid. |
| dark:bg-input/30 | The current dark-mode surface treatment. |
| text-md / rounded-md / h-9 / px-3 | Shared type, shape and dimensions, backed by the theme. |
Example binding
<Label htmlFor="display-name">Display name</Label>
<Input id="display-name" name="displayName" type="text" />A real use: FormControl and FormLabel
FormControl passes generated IDs and accessibility attributes to its child control. FormLabel uses the same ID. The form's author still supplies the Input, help text, validation rule and error message.
src/components/ui/form.tsxWhere to change it
Change input.tsx for input-wide borders, dimensions, focus treatment or forwarded props. Keep field names, validation rules and product-specific formatting in the form or feature.
Badge
Variant and asChild; no size or disabled API. Text conveys meaning, not color alone.
Current component with fictional data. Example changes are not persisted.
Badge renders a compact span with selectable visual variants. The caller supplies the text and any status-to-variant mapping. With asChild, a supplied element retains its native semantics while receiving the badge treatment.
Supported inputs
| Input | Default / ownership | What it does |
|---|---|---|
| variant | default | Choose default, secondary, destructive, outline, ghost or link. It has no built-in status rules. |
| asChild | false | Use another element, such as an anchor, while retaining the badge treatment. |
| className | optional | Adjust a particular badge's shared styles. |
| Native span props | forwarded | Includes children and aria-* attributes. There is no built-in size or disabled prop. |
Theme and style dependencies
| Token / utility | What it contributes |
|---|---|
| bg-primary / text-primary-foreground | Default badge pairing. |
| bg-secondary / text-secondary-foreground | Secondary pairing, used for draft submission summaries. |
| border-border / text-foreground | Outline treatment. |
| bg-destructive / text-white | Current destructive treatment uses literal white. |
| [a&]:hover:* / focus-visible:ring-ring | Some hover styles apply only to an actual anchor; focus styles do not make a span interactive. |
| text-xs / rounded-full / px-2 / py-0.5 | Compact type and pill-shaped geometry. |
Example binding
<Badge variant="secondary">Draft</Badge>A real use: SubmissionCard
SubmissionCard chooses secondary only when status is exactly draft; other statuses use outline. That choice belongs to the submission summary, not to Badge itself.
src/components/submissions/submissionCard.tsxWhere to change it
Change badgeVariants for the shared visual treatment. Keep status-to-text and status-to-variant decisions with the feature that understands those states.
Label
Radix label props. htmlFor must match the control ID; a placeholder is not a label.
Current component with fictional data. Example changes are not persisted.
Label wraps Radix Label.Root with shared typography and disabled-state styles. Supply a persistent field name and match htmlFor to the control's id. Styling does not establish that association.
Supported inputs
| Input | Default / ownership | What it does |
|---|---|---|
| Radix Label.Root props | forwarded | The underlying label primitive supplies the association behavior. |
| htmlFor | consumer supplied | Use the same ID as the control being named. |
| children | consumer supplied | Provide a clear, visible field name. |
| className | optional | Merged with the shared label styles. |
Theme and style dependencies
| Token / utility | What it contributes |
|---|---|
| text-label | The theme's purpose-driven label size. |
| leading-none / font-medium / gap-2 | Current line height, weight and spacing are explicit component choices. |
| group-data-[disabled=true] / peer-disabled | Disabled styling depends on the matching surrounding group or peer markup. |
Example binding
<Label htmlFor="contact-email">Contact email</Label>
<Input id="contact-email" type="email" />A real use: LabelWithInfo
LabelWithInfo combines the Label with a separate help trigger. The label names the control; the tooltip adds optional explanation. Neither takes ownership of the field's value or validation.
src/components/ui/field-label.tsxWhere to change it
Change Label for shared label typography and association behavior. Keep field wording with the consumer, and keep help, errors and required-field rules in the larger field composition.
Textarea
Native textarea props; formatting and preview are separate compositions.
Current component with fictional data. Example changes are not persisted.
Checkbox
Radix checked/onCheckedChange contract, including the indeterminate state.
Current component with fictional data. Example changes are not persisted.
Switch
Radix boolean checked/onCheckedChange; preference persistence is not built in.
Current component with fictional data. Example changes are not persisted.
Toggle
Radix pressed/onPressedChange plus local variants; not a form checkbox.
Current component with fictional data. Example changes are not persisted.
RadioGroup
A related-choice assembly. Its group coordinates value and focus; individual items remain focused controls.
Current component with fictional data. Example changes are not persisted.
Avatar
Image/fallback compound display. This example uses an actual fallback, not an external image.
Current component with fictional data. Example changes are not persisted.
Progress
Value-driven progress display. The consumer owns work and accessible labeling.
Current component with fictional data. Example changes are not persisted.
Skeleton
Loading presentation only; the consumer owns announcement and request lifecycle.
Current component with fictional data. Example changes are not persisted.
Where a change reaches
Change the shared atom for common visual structure, supported variants and accessibility. Change product copy and commands in its consumer. Local class overrides can mask a shared change. Exported helpers such as buttonVariants also style links without rendering Button.
import { Button } from "@/components/ui/button";
<Button type="button" variant="outline" size="sm" onClick={onContinue}>
Continue
</Button>docs/decisions/ADR-0031-frontend-component-taxonomy-and-product-instances.md