Buttons represent actions the user can take, such as submitting a form, opening a dialog, or navigating to another page.

Examples

Colors and Types

Solid
Neutral Primary Success Warning Danger Outline
Neutral Primary Success Warning Danger Clear
Neutral Primary Success Warning Danger
<strong>Solid</strong><br />
<orb-button>Neutral</orb-button>
<orb-button color="primary">Primary</orb-button>
<orb-button color="success">Success</orb-button>
<orb-button color="warning">Warning</orb-button>
<orb-button color="danger">Danger</orb-button>

<orb-divider></orb-divider>

<strong>Outline</strong><br />
<orb-button fill="outline">Neutral</orb-button>
<orb-button fill="outline" color="primary">Primary</orb-button>
<orb-button fill="outline" color="success">Success</orb-button>
<orb-button fill="outline" color="warning">Warning</orb-button>
<orb-button fill="outline" color="danger">Danger</orb-button>

<orb-divider></orb-divider>

<strong>Clear</strong><br />
<orb-button fill="clear">Neutral</orb-button>
<orb-button fill="clear" color="primary">Primary</orb-button>
<orb-button fill="clear" color="success">Success</orb-button>
<orb-button fill="clear" color="warning">Warning</orb-button>
<orb-button fill="clear" color="danger">Danger</orb-button>

Sizes

X-Small Small Medium Large
<orb-button size="xs">X-Small</orb-button>
<orb-button size="sm">Small</orb-button>
<orb-button>Medium</orb-button>
<orb-button size="lg">Large</orb-button>

Radius

Default Radius Pill
<orb-button>Default Radius</orb-button>
<orb-button radius="pill">Pill</orb-button>
<orb-button radius="circle">
  <iconify-icon icon="mdi:heart"></iconify-icon>
</orb-button>

Disabled

Medium
<orb-button color="primary" disabled>Medium</orb-button>

Pending

Save
HTML Javascript
<orb-button id="pending-button" color="primary">Save</orb-button>
const button = document.querySelector('#pending-button');
button.addEventListener('click', () => {
  button.pending = true;
  setTimeout(() => {
    button.pending = false;
  }, 2000);
});

Caret

Paragraph Paragraph Heading 1 Heading 2 Heading 3 Heading 4 Heading 5 Heading 6
HTML Javascript
<orb-button id="dropdown-button" caret space-between fill="clear">Paragraph</orb-button>
<orb-menu id="dropdown-menu" for="dropdown-button" mode="single">
  <orb-mi checked>Paragraph</orb-mi>
  <orb-mi>Heading 1</orb-mi>
  <orb-mi>Heading 2</orb-mi>
  <orb-mi>Heading 3</orb-mi>
  <orb-mi>Heading 4</orb-mi>
  <orb-mi>Heading 5</orb-mi>
  <orb-mi>Heading 6</orb-mi>
</orb-menu>
const menu = document.querySelector('#dropdown-menu');
const button = document.querySelector('#dropdown-button');
menu.addEventListener('orbSelect', (e) => {
  button.textContent = e.detail.item.textContent;
});

Properties

caret

Description If true, the button will have a caret
Attribute caret
Type boolean
Default false

color

Description Predefined colors
Attribute color
Type "danger" | "primary" | "success" | "warning"
Default undefined

disabled

Description Disables button
Attribute disabled
Type boolean
Default false

expand

Description Expands the button to the full width of it’s container
Attribute expand
Type boolean
Default false

fill

Description Button fill
Attribute fill
Type "clear" | "outline" | "solid"
Default "solid"

form

Description Can set form id to participate in forms. Use this if you need to place submit/reset button outside the form element
Attribute form
Type string
Default undefined

pending

Description Shows a loading spinner and disables the button
Attribute pending
Type boolean
Default false

radius

Description Button corners
Attribute radius
Type "circle" | "default" | "pill"
Default "default"

ready

Description A promise that resolves when the component has completed it’s initial render
Attribute –
Type Promise<unknown>
Default new Promise((res) => (this.#resolve = res))

size

Description Button size
Attribute size
Type "lg" | "md" | "sm" | "xs"
Default "md"

spaceBetween

Description If true, the button’s content will be spaced apart
Attribute space-between
Type boolean
Default false

type

Description Can set to submit or reset to participate in forms
Attribute type
Type "reset" | "submit"
Default undefined

value

Description Will be used as the value if it has a name and is nested in a form
Attribute value
Type File | FormData | string
Default undefined

Slots

Slot Description
Button content
"badge" Badge content

Shadow Parts

Part Description
"loading" The orb-loading element displayed when pending

Custom States

State Initial Value Description
:state(pending) false Whenever the button is pending

CSS Custom Properties

Name Description
--active-background Pressed background color
--background Default background color
--color Text color
--font-size Font size
--height Fixed height
--hover-background Hovered background color
--padding-inline Inner inline padding

Dependencies

Used by

Depends on

Graph

graph TD; orb-button --> orb-loading orb-alert --> orb-button orb-calendar --> orb-button orb-cell --> orb-button orb-copy-button --> orb-button orb-datepicker --> orb-button orb-file-input --> orb-button orb-menu --> orb-button orb-pill --> orb-button orb-rich-text --> orb-button orb-tab-button --> orb-button orb-textbox --> orb-button orb-view --> orb-button style orb-button fill:#f9f,stroke:#333,stroke-width:4px