Button
Buttons trigger actions. Primary is the one main action in a view or dialog; Secondary is every other action; Ghost is for low-emphasis actions in toolbars and lists. Rules: design system, UX Elements & Rules → Button (R-A8, R-A9).
Add it to a page
Load the pinned file once in your Latitude Site or web page, then use the tag.
<script type="module" src="https://web-components.sites.latd.com/components/lat-button/0.1.0/lat-button.js"></script>The file is an ES module. It loads Lit, the design-system tokens and the Roobert stylesheet from this catalog once per page, however many components you use.
| Version | 0.1.0 |
|---|---|
| File | /components/lat-button/0.1.0/lat-button.js (1.7 KB gzipped) |
| SHA-256 | c043bfdb88e4fdcd3dfc2da0916ea4c8603e90bd3935e35ef07b185a458b825f |
Permutations
Variants
DarkCreate study
Cancel
Show all
LightCreate study
Cancel
Show all
<lat-button variant="primary">Create study</lat-button>
<lat-button>Cancel</lat-button>
<lat-button variant="ghost">Show all</lat-button>Small and round
DarkSave
Cancel
Filters · 3
LightSave
Cancel
Filters · 3
<lat-button variant="primary" size="sm">Save</lat-button>
<lat-button size="sm">Cancel</lat-button>
<lat-button shape="round" size="sm">Filters · 3</lat-button>Danger and warning
DarkDelete study
Remove
Reset results
LightDelete study
Remove
Reset results
<lat-button variant="primary" intent="danger">Delete study</lat-button>
<lat-button intent="danger">Remove</lat-button>
<lat-button intent="warning">Reset results</lat-button>Disabled and loading
DarkCreate study
Cancel
Show all
Saving
LightCreate study
Cancel
Show all
Saving
<lat-button variant="primary" disabled>Create study</lat-button>
<lat-button disabled>Cancel</lat-button>
<lat-button variant="ghost" disabled>Show all</lat-button>
<lat-button variant="primary" loading>Saving</lat-button>In a form
Dark
Light
<form onsubmit="event.preventDefault(); this.querySelector('output').value = 'Submitted'">
<lat-button variant="primary" type="submit">Submit</lat-button>
<output></output>
</form>Attributes
| Attribute | Values | Notes |
|---|---|---|
variant | secondary (default), primary, ghost | Use one Primary per area. |
intent | default, danger, warning | Danger for destructive actions; Warning (Secondary only) for actions with consequences. |
size | md (default, 40px), sm (32px) | Ghost is always 32px. |
shape | default, round | Round for filters and buttons with a counter. |
type | button (default), submit, reset | Submits or resets the form the button is in. |
disabled | boolean | |
loading | boolean | Shows a spinner in place of the label and ignores clicks. The label is still read by screen readers. |