|
| 1 | +--- |
| 2 | +title: Button |
| 3 | +description: button |
| 4 | +--- |
| 5 | + |
| 6 | +import Preview from '~/components/Preview.astro' |
| 7 | +import { Button } from '@beanwei/astro-ui' |
| 8 | +import { Icon } from 'astro-icon/components' |
| 9 | + |
| 10 | +## Import |
| 11 | + |
| 12 | +```tsx |
| 13 | +import { Button } from '@beanwei/astro-ui' |
| 14 | +``` |
| 15 | + |
| 16 | +## Usage |
| 17 | + |
| 18 | +<Preview> |
| 19 | + <Fragment slot="preview"> |
| 20 | + <Button>Primary</Button> |
| 21 | + <Button variant="secondary">Secondary</Button> |
| 22 | + <Button variant="destructive">Destructive</Button> |
| 23 | + <Button variant="outline">Outline</Button> |
| 24 | + <Button variant="ghost">Ghost</Button> |
| 25 | + <Button variant="link">Link</Button> |
| 26 | + </Fragment> |
| 27 | + ```tsx |
| 28 | + --- |
| 29 | + import { Button } from '@beanwei/astro-ui' |
| 30 | + --- |
| 31 | + |
| 32 | + <Button>Primary</Button> |
| 33 | + <Button variant="secondary">Secondary</Button> |
| 34 | + <Button variant="destructive">Destructive</Button> |
| 35 | + <Button variant="outline">Outline</Button> |
| 36 | + <Button variant="ghost">Ghost</Button> |
| 37 | + <Button variant="link">Link</Button> |
| 38 | + ``` |
| 39 | +</Preview> |
| 40 | + |
| 41 | + |
| 42 | +### Icon |
| 43 | + |
| 44 | +<Preview> |
| 45 | + <Fragment slot="preview"> |
| 46 | + <Button variant="outline" size="icon"> |
| 47 | + <Icon name="lucide:chevron-right" /> |
| 48 | + </Button> |
| 49 | + <Button> |
| 50 | + <Icon name="lucide:mail-open" /> |
| 51 | + Login with Email |
| 52 | + </Button> |
| 53 | + </Fragment> |
| 54 | + ```tsx |
| 55 | + --- |
| 56 | + import { Button } from '@beanwei/astro-ui' |
| 57 | + import { Icon } from 'astro-icon/components' |
| 58 | + --- |
| 59 | + |
| 60 | + <Button variant="outline" size="icon"> |
| 61 | + <Icon name="lucide:chevron-right" /> |
| 62 | + </Button> |
| 63 | + <Button> |
| 64 | + <Icon name="lucide:mail-open" /> |
| 65 | + Login with Email |
| 66 | + </Button> |
| 67 | + ``` |
| 68 | +</Preview> |
| 69 | + |
| 70 | + |
| 71 | +### Loading |
| 72 | + |
| 73 | +<Preview> |
| 74 | + <Fragment slot="preview"> |
| 75 | + <Button data-state="loading" disabled> |
| 76 | + Please wait |
| 77 | + </Button> |
| 78 | + </Fragment> |
| 79 | + ```tsx |
| 80 | + --- |
| 81 | + import { Button } from '@beanwei/astro-ui' |
| 82 | + --- |
| 83 | + |
| 84 | + <Button data-state="loading" disabled> |
| 85 | + Please wait |
| 86 | + </Button> |
| 87 | + ``` |
| 88 | +</Preview> |
| 89 | + |
| 90 | + |
| 91 | +### As Child |
| 92 | + |
| 93 | +<Preview> |
| 94 | + <Fragment slot="preview"> |
| 95 | + <Button asChild> |
| 96 | + <a href="/">Home</a> |
| 97 | + </Button> |
| 98 | + </Fragment> |
| 99 | + ```tsx |
| 100 | + --- |
| 101 | + import { Button } from '@beanwei/astro-ui' |
| 102 | + --- |
| 103 | + |
| 104 | + <Button asChild> |
| 105 | + <a href="/">Home</a> |
| 106 | + </Button> |
| 107 | + ``` |
| 108 | +</Preview> |
0 commit comments