Skip to content

React Components

When you export your design system, DesignPush includes dp-react — a set of React components that consume your design tokens via CSS custom properties. Every component is fully controlled by the tokens you’ve configured in the editor.


  1. Copy the packages/dp-react/ folder into your project
  2. Import the component CSS in your entry point:
src/main.tsx
import './design-system/build/core/variables.css';
import './design-system/build/components/variables.css';
  1. Import components:
import { Button, Input, Card } from './dp-react';

Interactive button with four variants and three sizes.

<Button variant="primary" size="md">Save</Button>
<Button variant="ghost" size="sm" layout="icon-left" icon={<PlusIcon />}>Add item</Button>
<Button variant="destructive">Delete</Button>
PropTypeDefaultDescription
variant'primary' | 'secondary' | 'ghost' | 'destructive''primary'Visual style
size'sm' | 'md' | 'lg''md'Size
layout'label-only' | 'icon-only' | 'icon-left' | 'icon-right''label-only'Icon placement
iconReactNodeIcon element
togglebooleanfalseToggle button mode
isActivebooleanfalseActive state (for toggle)

Also accepts all native <button> attributes.


Status indicator with eight semantic variants and four visual styles.

<Badge variant="success" badgeStyle="subtle">Active</Badge>
<Badge variant="error" badgeStyle="bold">Failed</Badge>
<Badge variant="info" badgeStyle="outline" layout="icon-left" icon={<InfoIcon />}>Note</Badge>
PropTypeDefaultDescription
variant'neutral' | 'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'error' | 'info''neutral'Semantic color
badgeStyle'subtle' | 'bold' | 'outline' | 'code''subtle'Visual style
size'sm' | 'md''md'Size
layout'label-only' | 'icon-only' | 'icon-left' | 'icon-right''label-only'Icon placement
iconReactNodeIcon element
disabledbooleanfalseDisabled state

Single-line text input with optional icon and label.

<Input placeholder="Email address" />
<Input size="sm" error placeholder="Invalid" />
<Input label="Search" layout="icon-left" icon={<SearchIcon />} placeholder="Search..." />
PropTypeDefaultDescription
size'sm' | 'md''md'Size
errorbooleanfalseError state
labelstringLabel text
labelPosition'top' | 'left''top'Label placement
layout'label-only' | 'icon-left' | 'icon-right''label-only'Icon placement
iconReactNodeIcon element
onIconClick() => voidIcon click handler
type'text' | 'email' | 'password' | 'search' | 'tel' | 'url' | 'number''text'Input type

Also accepts all native <input> attributes.


Multi-line text input with label support.

<TextArea placeholder="Write a message..." rows={4} />
<TextArea size="sm" label="Notes" />
<TextArea error placeholder="Required field" />
PropTypeDefaultDescription
size'sm' | 'md''md'Size
errorbooleanfalseError state
labelstringLabel text
labelPosition'top' | 'left''top'Label placement
rowsnumber3Visible rows

Also accepts all native <textarea> attributes.


Custom dropdown select with search, groups, and custom rendering.

const options = [
{ value: 'apple', label: 'Apple' },
{ value: 'banana', label: 'Banana' },
];
<Select options={options} value={value} onChange={setValue} />
<Select options={options} searchable placeholder="Choose..." />
PropTypeDefaultDescription
optionsSelectOption[]Flat option list
groupsSelectOptionGroup[]Grouped options (use instead of options)
valuestringSelected value
onChange(value: string) => voidChange handler
placeholderstring'Select...'Placeholder text
size'sm' | 'md''md'Size
variant'default' | 'menu' | 'button''default'Visual style
labelstringLabel text
labelPosition'top' | 'left''top'Label placement
searchablebooleanfalseEnable type-to-search
searchPlaceholderstring'Search...'Search field placeholder
collapsibleGroupsbooleanfalseAllow group collapse
disabledbooleanfalseDisabled state
errorbooleanfalseError state
placement'bottom' | 'top'Dropdown direction
maxHeightstringDropdown max height
renderOption(option, state) => ReactNodeCustom option renderer
renderValue(option) => ReactNodeCustom trigger renderer
headerReactNodeContent above options
loadMore() => voidInfinite scroll callback
hasMorebooleanfalseMore items available

SelectOption: { value: string; label: string; badge?: ReactNode; disabled?: boolean }

SelectOptionGroup: { label: string; options: SelectOption[]; defaultOpen?: boolean }


Toggle switch with label and semantic variants.

<Switch checked={on} onChange={handleChange} />
<Switch label="Dark mode" size="sm" />
<Switch label="Delete" variant="destructive" labelPosition="left" />
PropTypeDefaultDescription
size'sm' | 'md''md'Size
variant'default' | 'success' | 'destructive''default'Color variant
labelstringLabel text
labelPosition'left' | 'right''right'Label placement

Also accepts all native <input> attributes (except size and type).


Checkbox input with indeterminate state support.

<Checkbox label="Accept terms" />
<Checkbox checked indeterminate label="Select all" />
<Checkbox size="sm" label="Remember me" labelPosition="left" />
PropTypeDefaultDescription
size'sm' | 'md''md'Size
indeterminatebooleanfalseIndeterminate state
labelstringLabel text
labelPosition'left' | 'right''right'Label placement

Also accepts all native <input> attributes (except size and type).


Radio button group for single-selection.

<RadioGroup name="color" value={color} onChange={(e) => setColor(e.target.value)}>
<Radio value="red" label="Red" />
<Radio value="blue" label="Blue" />
<Radio value="green" label="Green" />
</RadioGroup>

RadioGroup:

PropTypeDefaultDescription
namestringrequiredGroup name
valuestringSelected value
onChange(e: ChangeEvent) => voidChange handler
direction'vertical' | 'horizontal''vertical'Layout direction
size'sm' | 'md''md'Size for all radios
labelstringGroup label
disabledbooleanDisable all radios

Radio:

PropTypeDefaultDescription
size'sm' | 'md'Size (inherits from group)
labelstringLabel text
labelPosition'left' | 'right''right'Label placement

Range slider input.

<ThumbSlider min={0} max={100} value={50} onChange={handleChange} />
<ThumbSlider size="sm" min={0} max={1} step={0.1} />
PropTypeDefaultDescription
size'sm' | 'md''md'Size
minnumber0Minimum value
maxnumber100Maximum value
stepnumber1Step increment
valuenumberControlled value
defaultValuenumberminInitial value (uncontrolled)

Also accepts all native <input> attributes (except size and type).


Hover tooltip with configurable position and delay.

<Tooltip content="Save changes" position="top">
<Button>Save</Button>
</Tooltip>
PropTypeDefaultDescription
contentReactNoderequiredTooltip content
childrenReactNoderequiredTrigger element
position'top' | 'bottom' | 'left' | 'right''top'Placement
delaynumber200Show delay in ms

Compound card component with header, body, and footer sections.

<Card variant="elevated" size="md">
<CardHeader title="Settings" description="Manage your preferences" />
<CardBody>
<p>Card content here</p>
</CardBody>
<CardFooter>
<Button variant="primary">Save</Button>
</CardFooter>
</Card>

Card:

PropTypeDefaultDescription
variant'default' | 'elevated' | 'interactive''default'Visual style
size'sm' | 'md' | 'lg'Size

CardHeader:

PropTypeDefaultDescription
titlestringHeader title
descriptionstringSubtitle text
subtitlestringSecondary subtitle
avatarReactNodeAvatar or icon
childrenReactNodeCustom header content

CardBody / CardFooter: Accept children and className.


User avatar with image, initials, or icon content.

<Avatar src="/photo.jpg" alt="Jane" size="lg" />
<Avatar variant="primary" size="md">JS</Avatar>
<Avatar variant="neutral" size="sm" />
PropTypeDefaultDescription
size'sm' | 'md' | 'lg' | 'xl''md'Size
variant'primary' | 'neutral' | 'secondary''primary'Color variant
srcstringImage URL
altstringAlt text
childrenReactNodeInitials or icon

Horizontal rule separator.

<Divider />
<Divider variant="strong" />
PropTypeDefaultDescription
variant'subtle' | 'strong''subtle'Visual weight

Horizontal tab navigation.

const tabs = [
{ id: 'general', label: 'General' },
{ id: 'security', label: 'Security' },
];
<TabBar tabs={tabs} activeTab={active} onTabChange={setActive} />
PropTypeDefaultDescription
tabsTab[]requiredTab definitions
activeTabstringrequiredActive tab ID
onTabChange(tabId: string) => voidrequiredTab change handler
size'sm' | 'md''md'Size
controlsReactNodeRight-side controls

Tab: { id: string; label: string }


Every component reads its visual properties from CSS custom properties. When you change tokens in DesignPush and re-export, the components update automatically — no code changes needed.

DesignPush editor → tokens-components.json → build/components/variables.css → dp-react components

For example, changing the button’s border radius in the editor updates --pattern-button-base-tokens-border-radius, which the Button component consumes directly.

You can override any component token with inline styles or scoped CSS:

{/* Override button radius for this instance */}
<div style={{ '--pattern-button-base-tokens-border-radius': '999px' } as React.CSSProperties}>
<Button>Pill button</Button>
</div>

All dp-react components use the dp- class prefix (e.g., dp-button, dp-input, dp-card). This avoids conflicts if you’re using other component libraries alongside dp-react.