Button
Button triggers an action, with default, primary and text variants.
import { Button } from '@lobehub/ui';Introduction
Button is the sample component of this playground. Its page follows the layout described in Component Pages and exercises each demo mode the kit supports, so a change that breaks one of them fails the playground build in CI.
Basic usage
Playground
An interactive playground built with StoryBook and useControls from @lobehub/ui/storybook, rendered with layout="bare".
Variants
Variants
Lazy content
This demo loads its label with a dynamic import(), which the live editor cannot run, so the page sets editable={false}.
Props
A hand-written Markdown table still works next to the generated one.
| Property | Description | Type |
|---|---|---|
htmlType | Native button type | 'button' | 'reset' | 'submit' |
rest | Remaining native attributes | Omit<ButtonHTMLAttributes, 'type'> |
variant | Visual weight | 'default' | 'primary' | 'text' |
API
childrennull | string | number | bigint | false | true | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.ReactPortal | Promise<AwaitedReactNode>Content rendered inside the button.
htmlType'button' | 'reset' | 'submit'Native button type.
Defaults to
"button".variant'text' | 'default' | 'primary'Visual weight of the button.
Defaults to
"default".
Also accepts all native HTML and ARIA attributes.