Buttons are used to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation.
block
false
align
center
block
. Can be start
or center
as
button
button
or a
.button
<button>
element (bindable).<Button size="x-small">X-Small Button</Button>
<Button size="small">Small Button</Button>
<Button size="medium">Medium Button</Button>
<Button size="large">Large Button</Button>
<Button color="accent" variant="fill">Fill Accent</Button>
<Button color="gray" variant="fill">Fill Gray</Button>
<Button color="green" variant="fill">Fill Green</Button>
<Button color="red" variant="fill">Fill Red</Button>
<Button color="blue" variant="fill">Fill Blue</Button>
<Button color="orange" variant="fill">Fill Orange</Button>
<Button color="input" variant="fill">Fill Button</Button>
<Button color="accent" variant="fill-light">Fill Accent</Button>
<Button color="gray" variant="fill-light">Fill Gray</Button>
<Button color="green" variant="fil-light">Fill Green</Button>
<Button color="red" variant="fill-light">Fill Red</Button>
<Button color="blue" variant="fill-light">Fill Blue</Button>
<Button color="orange" variant="fill-light">Fill Orange</Button>
<Button color="accent" variant="outline">Outline Accent</Button>
<Button color="gray" variant="outline">Outline Gray</Button>
<Button color="green" variant="outline">Outline Green</Button>
<Button color="red" variant="outline">Outline Red</Button>
<Button color="blue" variant="outline">Outline Blue</Button>
<Button color="orange" variant="outline">Outline Orange</Button>
<Button color="accent" variant="outline-fill">Outline-fill Accent</Button>
<Button color="gray" variant="outline-fill">Outline-fill Gray</Button>
<Button color="green" variant="outline-fill">Outline-fill Green</Button>
<Button color="red" variant="outline-fill">Outline-fill Red</Button>
<Button color="blue" variant="outline-fill">Outline-fill Blue</Button>
<Button color="orange" variant="outline-fill">Outline-fill Orange</Button>
<Button color="accent" variant="invisible">Invisible Accent</Button>
<Button color="gray" variant="invisible">Invisible Gray</Button>
<Button color="green" variant="invisible">Invisible Green</Button>
<Button color="red" variant="invisible">Invisible Red</Button>
<Button color="blue" variant="invisible">Invisible Blue</Button>
<Button color="orange" variant="invisible">Invisible Orange</Button>
<Button color="input" variant="invisible">Invisible Input</Button>
default
- The content (label) of the button.
<Button>Search</Button>
start
- Placed before the content (e.g. icon). <Button>
<IconSearch slot="start" />
Search
</Button>
end
- Placed after the content (e.g. icon). <Button>
Search
<IconSearch slot="end" />
</Button>
action
- Placed after the content, locked to the right side of the button. This is
useful with the block
property. <Button block color="gray">
<IconSearch slot="start" />
Search
<IconCaretDown slot="action" />
</Button>
The as
property can be used to render the button as a link.
<Button as="a" href="https://hyvor.com" target="_blank">
HYVOR <IconBoxArrowUpRight slot="end" />
</Button>
The Loader component can be used to indicate a loading state.
<Button>
Submit
<Loader slot="action" size="small" invert />
</Button>
<Button>
<svelte:fragment slot="start">{#if loading}<Loader />{/if}</svelte:fragment>
Button
</Button>
You can use the disabled
attribute to disable a button.
<Button disabled>Disabled Button</Button>
You can use the ButtonGroup
component to group buttons together.
<ButtonGroup>
<Button>Button 1</Button>
<Button>Button 2</Button>
<Button>Button 3</Button>
</ButtonGroup>