Button
Capsule button in five styles and three sizes, with optional icons and a loading state.
Code
import * as React from 'react';
import { Button } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
gap: 14,
}}
>
<div
style={{
display: 'flex',
flexWrap: 'wrap',
gap: 10,
}}
>
<Button>Continue</Button>
<Button variant="tinted" icon="plus">
Add to library
</Button>
<Button variant="gray">Cancel</Button>
<Button variant="plain">Learn more</Button>
<Button variant="destructive" icon="trash">
Delete
</Button>
</div>
<div
style={{
display: 'flex',
flexWrap: 'wrap',
gap: 10,
alignItems: 'center',
}}
>
<Button size="lg">Large</Button>
<Button size="sm" variant="gray">
Small
</Button>
<Button loading>Saving</Button>
<Button disabled>Disabled</Button>
</div>
</div>
);
}Sizes and states
import { Button } from '@fruit-labs/design';
export default function Example() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 12, alignItems: 'center' }}>
<Button size="sm">Small</Button>
<Button>Medium</Button>
<Button size="lg">Large</Button>
<Button loading>Saving</Button>
<Button disabled>Disabled</Button>
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { Button } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/button.jsonGuidelines
- One
filledbutton per view: the primary action.tinted/grayfor secondary,plainfor inline and tertiary. destructive(tinted) in menus and lists;danger(filled red) only in the confirm step.- Label with a verb: Save, Invite, Delete project. Sizes: lg 50 (phone/hero), md 36 (default web), sm 28 (toolbars, tables).
- Pass
hrefto render a link that looks like a button.
Props
| Prop | Type | Required |
|---|---|---|
variant | 'filled' | 'tinted' | 'gray' | 'plain' | 'destructive' | 'danger' | 'glass' | No |
size | 'sm' | 'md' | 'lg' | No |
icon | string | React.ReactNode | No |
iconRight | string | React.ReactNode | No |
loading | boolean | No |
block | boolean | No |
href | string | No |
disabled | boolean | No |
onClick | (e: React.MouseEvent) => void | No |
type | 'button' | 'submit' | 'reset' | No |
className | string | No |
children | React.ReactNode | No |