Getting Started
Components
- Advanced Toast
- ArrowButton
- Arrows
- Avatar
- Backdrop
- Basic Toast
- Breadcrumb
- Button
- CardBackground
- Card
- ChatButton
- Checkbox
- Checkboxes
- Chip
- ChoiceExpander
- Clickable
- Date Field
- Dropdown
- ElasticHeight
- ExpandableCard
- Filter
- FormCheckbox
- Form Control
- Form Label
- HamburgerIcon
- Heading
- Image
- Link
- Loader
- Number Field
- Pagination
- Password
- Phone Field
- Popin
- Portal
- Prose
- Radio Group
- Radio
- Range
- Select
- SidebarLayout
- Spinner
- Switch
- Tabs
- Tag
- TextField
- ValidationMessage
PrimarySecondaryTertiary
'use client';
import { Button } from '@/ui/buttons/Button';
export function ButtonDemo() {
return (
<div>
Primary
<Button color="saffron" theme="solid" variant="pill">
Click me
</Button>
Secondary
<Button color="saffron" size="medium" theme="solid" variant="pill">
Click me
</Button>
Tertiary
<Button color="saffron" size="small" theme="solid" variant="pill">
Click me
</Button>
</div>
);
}
Installation
npx shadcn@latest add https://develop.trident-ui.pro.clubmed/r/button.json
Usage
import { Button } from '@/docs/lib/ui/Button';
export function Component() {
return (
<Button color="saffron" size="medium" theme="solid" variant="pill">
Click me
</Button>
);
}API Reference
Button
| Prop | Type | Default | Description |
|---|---|---|---|
color | "black" | "darkGrey" | "green" | "lavender" | "lightGrey" | "lightSand" | "marygold" | "orange" | "red" | "saffron" | "sand" | "sienna" | "ultramarine" | "verdigris" | "wave" | "white" | "current" | "saffron" | The color theme of the button |
icon | IconicNames | undefined | Optional icon name from the Trident Icons library |
iconType | IconicTypes | undefined | Force the icon type to be svg, font or default |
iconWidth | string | undefined | Custom width for the icon (e.g., "24px") |
size | "small" | "medium" | "large" | "medium" | The size of the button |
theme | "outline" | "solid" | "solid" | The visual style of the button - solid for filled background, outline for border only |
variant | "circle" | "pill" | "pill" | The shape of the button - circle for circular buttons, pill for rounded rectangular buttons |
component | "button" | "a" | "span" | "div" | ReactElement | "button" | The underlying HTML element or React component to render |
disabled | boolean | false | Whether the button is disabled (sets disabled attribute or aria-disabled for anchors) |
children | ReactNode | undefined | The content to display inside the button |
Examples
'use client';
import { Button } from '@/ui/buttons/Button';
export function ButtonOutlineDemo() {
return (
<Button color="saffron" size="medium" theme="outline" variant="pill">
Learn more
</Button>
);
}
'use client';
import { Button } from '@/ui/buttons/Button';
export function ButtonSmallDemo() {
return (
<Button color="ultramarine" size="small" theme="solid" variant="circle">
hi!
</Button>
);
}
'use client';
import { Button } from '@/ui/buttons/Button';
export function ButtonLargeDemo() {
return (
<Button color="saffron" size="large" theme="solid" variant="circle">
Get started
</Button>
);
}
'use client';
import { Button } from '@/ui/buttons/Button';
export function ButtonIconDemo() {
return (
<Button color="saffron" size="medium" theme="solid" variant="pill" icon="ArrowDefaultRight">
Continue
</Button>
);
}
'use client';
import { Button } from '@/ui/buttons/Button';
export function ButtonDisabledDemo() {
return (
<Button color="saffron" size="medium" theme="solid" variant="pill" disabled>
Submit
</Button>
);
}
'use client';
import { Button } from '@/ui/buttons/Button';
export function ButtonCircleDemo() {
return (
<Button color="saffron" size="medium" theme="solid" variant="circle" icon="HeartOutlined">
<span className="sr-only">Add to favorites</span>
</Button>
);
}
Notes
- The Button component is polymorphic and can render as a
<button>,<a>,<span>,<div>, or any custom React component - When
component="a"or anhrefprop is provided, the button renders as an anchor element with appropriate accessibility attributes - The
disabledprop sets the nativedisabledattribute on button elements andaria-disabledon anchor and fake button elements - All standard HTML button attributes (onClick, onFocus, etc.) are supported and forwarded to the underlying element
- The component automatically handles button type, defaulting to
type="button"to prevent form submission