Button
Loading example…
Button is part of the Atoms set, imported from @jcsoftdev/ui/atoms.
Import
Section titled “Import”import { Button } from "@jcsoftdev/ui/atoms";Single-component entry points tree-shake to just this component: @jcsoftdev/ui/atoms/button.
<Button variant="primary" size="md"> Reservar corte</Button>| Prop | Type | Default | Description |
|---|---|---|---|
variant |
"danger" | "primary" | "secondary" | "ghost" |
"secondary" |
|
size |
"sm" | "md" | "lg" |
"md" |
sm is 30px and md (default) 38px, the heights every form control shares; lg is 52px. |
loading |
boolean |
Busy state: the button keeps its focus and its full colour, ignores clicks (a submit button no longer submits, including the implicit submit from Enter in a field of its form) and is exposed as aria-disabled and aria-busy. It is not natively disabled, s… |
|
loadingLabel |
string |
Replaces the children while loading and is announced to screen readers. Without it the children stay and the UI string loading is announced while loading. |
|
block |
boolean |
Stretch to the full width of the container. | |
asChild |
boolean |
Render the child element (via Slot) instead of a <button>, e.g. a link. |
|
intent |
string |
||
intentKey |
string |
* marks a required prop.
It also accepts the native props of the element or primitive it renders (for example className, id, aria-* and event handlers).
Storybook stories
Section titled “Storybook stories”- Default
- Secondary
- Ghost
- Danger
- Small
- Loading
- Large
- Block
- Loading With Label
- Disabled
- Disabled While Loading
- Loading Keeps Focus And Blocks Resubmit
- With Icon
- As Link
- Long Label
Source
Section titled “Source”packages/ui/src/atoms/button/button.tsx