A button is a widget that enables users to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation.
<nve-button>standard</nve-button>
Installation
<script type="module">
import '@nvidia-elements/core/button/define.js';
</script>
<nve-button>standard</nve-button>
Options
Interaction
The Interaction type provides a way to show the intent of an interactive element. This can help users quickly understand what each interaction does and reduce the potential for confusion or errors.
Interaction Description emphasis Shows the interaction targets emphasis or highlighting primary actions. destructive Shows the interaction targets destructive actions such as deleting or removing.
Interaction states that communicate button hierarchy, importance, and availability to users.
<div nve-layout="row gap:xs">
<nve-button>standard</nve-button>
<nve-button interaction="emphasis">emphasis</nve-button>
<nve-button interaction="destructive">destructive</nve-button>
</div>
standard
emphasis
destructive
Container
Demonstrates different container styles to accommodate visual weight and context.
Container Description flat Element has white space bounds but reduced visual container. inline Element container reduces to fit within inline content such as a block of text.
Container style variants for buttons to accommodate different visual weight and context.
<div nve-layout="row gap:xs align:vertical-center">
<nve-button container="inline">inline</nve-button>
<nve-button container="flat">flat</nve-button>
<nve-button>default</nve-button>
</div>
Size
Controls the visual scale of an element to match its importance and available space.
Size Description sm Compact size for dense layouts or secondary elements with less visual prominence. md Standard size that works well in most contexts and provides balanced visibility. lg Larger size for emphasizing important elements or improving touch targets in spacious layouts.
Button size variants to accommodate layout densities and touch target requirements.
<div nve-layout="row gap:xs">
<nve-button size="sm">small button</nve-button>
<nve-button>standard button</nve-button>
<nve-button size="lg">large button</nve-button>
</div>
small button
standard button
large button
Pressed
Indicates the current state of a toggle button that switches on or off. MDN
Pressed Description true The button is in the pressed (on) state and the associated action or setting is active. false The button is in the unpressed (off) state and the associated action or setting is inactive.
Pressed state for toggle buttons marking active/selected state with clear visual feedback.
<div nve-layout="row gap:xs align:vertical-center">
<nve-button pressed container="inline">pressed inline</nve-button>
<nve-button pressed container="flat">pressed flat</nve-button>
<nve-button pressed>pressed</nve-button>
</div>
pressed inline
pressed flat
pressed
Selected
Indicates whether an element currently holds selection within a multi-option selection group. MDN
Selected Description true The element holds selection and represents the user's current choice within the group. false The element does not hold selection and the user can choose it.
Button selection states to accommodate different visual weight and context.
<div nve-layout="row gap:xs align:vertical-center">
<nve-button selected container="inline">selected inline</nve-button>
<nve-button selected container="flat">selected flat</nve-button>
<nve-button selected>selected</nve-button>
</div>
selected inline
selected flat
selected
Disabled
This Boolean attribute prevents the user from interacting with the element: it cannot receive press or focus events. MDN
Disabled Description true The element has a disabled state and does not accept interaction. false The element has an enabled state and accepts interaction.
Button disabled states to accommodate different visual weight and context.
<div nve-layout="row gap:xs align:vertical-center">
<nve-button disabled container="inline">disabled inline</nve-button>
<nve-button disabled container="flat">disabled flat</nve-button>
<nve-button disabled>disabled</nve-button>
</div>
disabled inline
disabled flat
disabled
Guidelines
Icon Usage
Button with icons positioned before or after text to enhance visual clarity and user understanding.
<nve-button><nve-icon name="person"></nve-icon> button</nve-button>
<nve-button>button <nve-icon name="person"></nve-icon></nve-button>
Use the form control option for buttons that open custom controls such as dropdowns, filter menus, or pickers within a form layout. This pattern keeps the UI cohesive and helps users recognize the button as part of the form.
<div nve-layout="row gap:xs" style="max-width: 400px">
<nve-search>
<input type="search" placeholder="search" aria-label="search" />
</nve-search>
<nve-button nve-control>filter option <nve-icon name="caret" direction="down" size="sm"></nve-icon></nve-button>
</div>
Disclosing Progress
Use a progress ring within a button to communicate that an action is processing and prevent repeated submissions. Limit this pattern to short, indeterminate actions (about five seconds or less); for longer or determinate tasks, use a progress bar or ring outside the button.
<nve-button>
<nve-progress-ring status="neutral" size="xxs"></nve-progress-ring>
Submitting
</nve-button>
Ensure Contrast on Colored Background
Use standard interaction styling to keep buttons readable on contrasting backgrounds in light and dark themes. This pattern verifies the static button colors that deliver the intended contrast for each theme.
<div nve-layout="column gap:lg" style="width: 280px">
<nve-toolbar status="accent">
<div nve-text="label medium sm">10 Selected</div>
<nve-button slot="suffix">Edit</nve-button>
</nve-toolbar>
<nve-alert-group status="danger">
<nve-alert> Error Detected <nve-button slot="actions" container="flat">Review</nve-button> </nve-alert>
</nve-alert-group>
<nve-card style="width: 280px">
<nve-card-content
style="
width: 100%;
height: 100%;
aspect-ratio: 16/9;
object-fit: cover;
background: repeating-conic-gradient(var(--nve-sys-layer-overlay-background) 0% 25%, transparent 0% 50%) 50% /
40px 40px;
background-position: center;
border-style: hidden;
"
>
</nve-card-content>
<nve-card-footer>
<div nve-layout="row gap:xs">
<nve-button container="flat" style="margin-left: auto">Cancel</nve-button>
<nve-button>action</nve-button>
</div>
</nve-card-footer>
</nve-card>
</div>
10 Selected
Edit
Error Detected
Review
Do
Don't
Button styled as a link by slotting an anchor tag inside. Use when an action needs button visual treatment while maintaining semantic link navigation and accessibility.
<nve-button><a href="#">default</a></nve-button>
Do not wrap buttons in anchor tags.
<a href="#"><nve-button>default</nve-button></a>
Release Status
All elements and features go through 3 phases of stability, pre-release, beta and stable.
pre-release
Docs Preview
API Documentation
Fully Themeable
beta
Robust unit test coverages
Passed API Review
Passed Designer VQA Review
Included in library package
stable
No known outstanding AA WCAG issues
No known outstanding performance issues
Adapts to different screen/container sizes
No breaking API changes for at least 90 days