HomeGetting StartedColor SystemTypographySpacingIconographyLayoutInstallationUsageAngularBlazorReactSvelteVueThemingTypographyCustomizationCSS-Only ComponentsFormsIconsIllustrationsAccessibilityGlobal ConfigurationTailwind CSSSass LibraryForge MCP ServerDropdown OptionsFocus Indicator ClippingAll componentsButtonButton AreaChipFloating Action ButtonIcon ButtonSplit ButtonAutocompleteButton ToggleCalendarCheckboxChip FieldColor PickerDate PickerDate Range PickerFile PickerLabelRadioSelectSliderSwitchText FieldTime PickerApp BarApp LauncherDrawerMenuPaginatorSkip LinkStepperTabsView SwitcherAccordionApp LayoutCardDividerExpansion PanelScaffoldSplit ViewStackStructured CardToolbarBadgeBannerBusy IndicatorCircular ProgressDialogInline MessageLinear ProgressPage StateSkeletonToastTooltipAvatarIconKeyLabel ValueListMeterSecretTableTimelineTimestampTreeKeyboard ShortcutPopoverIntroductionColorTypographySpacingShapeBorderElevationLayeringAnimationUsageIcon LibraryBlocksRoadmapChangelogBlog

Button

Buttons allow users to take actions and make choices with a single tap.

ButtonButtonButton

Overview

Buttons communicate actions that users can take. They are typically placed throughout your UI in places such as dialogs, forms, cards, tables, toolbars, etc.

Usage

forge-button handles every level of action emphasis through variant, size, and theme, plus icons, anchor navigation, loading, and disabled states. Pick the variant that matches an action’s importance, reserve filled for the one primary action per view, and let theme, icon, and state carry the rest.

Rules

Do
Use sentence case ("Start new").Use short, actionable verbs ("Submit", "Save", "Delete").Use the primary theme color.One filled button per group, placed at the end (right).Space adjacent buttons with --forge-spacing-medium (--forge-spacing-xsmall in dense layouts).
Don't
Don't use more than one filled button per page or dialog.Don't put two filled buttons next to each other.Don't use success or warning colors — use primary.Don't pair overlapping actions ("Start over" + "Cancel").

Variants

Pick one variant per action, based on its level. Filled is the primary action — never more than one per page or dialog. Tonal is for secondary actions, and text is for tertiary actions like dismiss or skip. Outlined and raised are available but aren’t part of this hierarchy; see Grouping for how to combine levels.

The four button variants, ordered from lowest to highest emphasis.

Theme

Buttons default to the primary theme. Use theme="error" for destructive confirmations. Success and warning themes exist but should be reserved for status-conveying actions inside toolbars or lists — never for the primary submit on a form.

Primary is the default. Reserve error for destructive actions; the remaining themes exist but should be used sparingly.

Grouping

Buttons in a group follow an action hierarchy. Give each action a level, then use the matching variant:

  • Primary uses filled. This is the single main action. Use at most one per page or dialog.
  • Secondary uses tonal. This is an alternative to the primary action.
  • Tertiary uses text. This is a low-emphasis action.

Order buttons by level from right to left: primary at the end (right), secondary to its left, and tertiary leftmost. Space buttons with --forge-spacing-medium. For a destructive action, keep its level and add theme="error". Groups have at most 3 buttons; move any extra actions into a forge-menu.

Action levels

Level Variant Position
Primary filled Rightmost (end)
Secondary tonal Left of primary
Tertiary text Leftmost

Combinations

Actions Layout (left to right) Example
Primary + secondary (default) tonal, filled Cancel, Save
Primary + tertiary text, filled Skip, Continue
Primary + secondary + tertiary text, tonal, filled Cancel, Save draft, Submit
Secondary + tertiary text, tonal Dismiss, View details
Destructive primary tonal, filled + theme="error" Cancel, Delete

Wrap an <a> in a forge-button to get a navigation link styled as a button. Use this sparingly — buttons imply action, links imply navigation. If the action is “go somewhere”, prefer a plain link.

A button that navigates. Note the anchor child.

With an icon

Wrap an <forge-icon> in a forge-button to add an icon to the button. Icons can be placed at the start or end of the button label to reinforce the action.

Icons go in the start slot for actions, end slot for directional cues.

Loading

Forge doesn’t ship a built-in loading state on forge-button. To indicate a pending action, swap in a forge-circular-progress alongside the label.

A spinner in the end slot conveys a pending action.

Disabled

Set disabled to remove a button from the tab order and prevent interaction — every variant supports it.

Every variant supports disabled.

Buttons are used when a user needs to take an action. They can be used to trigger an action, navigate to a new location, and can be styled with a variety of themes and variants.

import "@tylertech/forge/button";
Properties
PropertyAttributeTypeDefaultDescription
variantvariantButtonVariant'text'Gets/sets the button variant.
pillpillbooleanfalseGets/sets whether the button is pill-shaped.
themethemeButtonTheme'primary'Gets/sets the button theme.
fullWidthfull-widthbooleanfalseGets/sets whether the button is full-width.
typetypeButtonType'button'Gets/sets the type of button.
disableddisabledbooleanfalseGets/sets whether the button is disabled.
densedensebooleanfalseGets/sets whether the button is dense.
popoverIconpopover-iconbooleanfalseGets/sets whether to show a popover icon.
namenamestring''Gets/sets the button name for form association.
valuevaluestring''Gets/sets the button value for form submission.
commandcommandCommandType''Indicates to the targeted element which action to take.
commandForcommand-forstring''Targets another element to be invoked.
commandForElement—HTMLElement | undefinedundefinedTargets another element to be invoked.
Events
NameTypeDescription
clickPointerEventFires when the button is clicked.
Slots
NameDescription
(default)This is a default/unnamed slot for the label text.
startElements to logically render before the label text.
endElements to logically render after the label text.
CSS Parts
NameDescription
::part(root)The root container element.
::part(focus-indicator)The focus-indicator indicator element.
::part(state-layer)The state-layer surface element.
CSS Custom Properties
NameDescription
--forge-button-primary-colorThe primary color of the button.
--forge-button-text-colorThe text color of the button. Inherits from primary color.
--forge-button-disabled-colorThe disabled color of the button.
--forge-button-paddingThe padding of the button.
--forge-button-displayThe display of the button.
--forge-button-justifyThe flex justify of the button.
--forge-button-shapeThe shape of the button.
--forge-button-heightThe height of the button.
--forge-button-min-widthThe min-width of the button.
--forge-button-spacingThe spacing of the button.
--forge-button-border-widthThe border-width of the button.
--forge-button-border-styleThe border style of the button.
--forge-button-border-colorThe border color of the button.
--forge-button-shape-start-start-radiusThe shape start start radius of the button.
--forge-button-shape-start-end-radiusThe shape start end radius of the button.
--forge-button-shape-end-start-radiusThe shape end start radius of the button.
--forge-button-shape-end-end-radiusThe shape end end radius of the button.
--forge-button-padding-blockThe padding block of the button.
--forge-button-padding-inlineThe padding inline of the button.
--forge-button-backgroundThe background color of the button.
--forge-button-hover-backgroundThe background color of the button on hover.
--forge-button-active-backgroundThe background color of the button on active state.
--forge-button-colorThe text color of the button.
--forge-button-icon-sizeThe size of the icon in the button.
--forge-button-shadowThe shadow of the button.
--forge-button-hover-shadowThe shadow of the button on hover.
--forge-button-active-shadowThe shadow of the button on active state.
--forge-button-cursorThe cursor type of the button.
--forge-button-transition-durationThe transition duration of the button.
--forge-button-transition-timingThe transition timing of the button.
--forge-button-text-padding-inlineThe inline padding of the button when using the text variant.
--forge-button-filled-backgroundThe background color of the filled button.
--forge-button-filled-disabled-backgroundThe background color of the disabled filled button.
--forge-button-filled-colorThe text color of the filled button.
--forge-button-filled-disabled-colorThe text color of the disabled filled button.
--forge-button-raised-backgroundThe background color of the raised button.
--forge-button-raised-disabled-backgroundThe background color of the disabled raised button.
--forge-button-raised-colorThe text color of the raised button.
--forge-button-raised-disabled-colorThe text color of the disabled raised button.
--forge-button-raised-shadowThe shadow of the raised button.
--forge-button-raised-hover-shadowThe shadow of the raised button on hover.
--forge-button-raised-active-shadowThe shadow of the raised button on active state.
--forge-button-raised-disabled-shadowThe shadow of the disabled raised button.
--forge-button-flat-backgroundThe background color of the flat button.
--forge-button-flat-disabled-backgroundThe background color of the disabled flat button.
--forge-button-flat-colorThe text color of the flat button.
--forge-button-flat-disabled-colorThe text color of the disabled flat button.
--forge-button-outlined-backgroundThe background color of the outlined button.
--forge-button-outlined-colorThe text color of the outlined button.
--forge-button-outlined-border-widthThe border width of the outlined button.
--forge-button-outlined-border-styleThe border style of the outlined button.
--forge-button-outlined-border-colorThe border color of the outlined button.
--forge-button-link-colorThe text color of the link button.
--forge-button-link-text-decorationThe text decoration of the link button.
--forge-button-link-heightThe height of the link button.
--forge-button-link-paddingThe padding of the link button.
--forge-button-link-line-heightThe line height of the link button.
--forge-button-link-widthThe width of the link button.
--forge-button-link-hover-text-decorationThe text decoration of the link button on hover.
--forge-button-link-active-opacityThe opacity of the link button on active state.
--forge-button-link-transition-durationThe transition duration of the link button.
--forge-button-link-transition-timingThe transition timing of the link button.
--forge-button-disabled-cursorThe cursor type of the disabled button.
--forge-button-disabled-text-colorThe text color of the disabled button.
--forge-button-disabled-backgroundThe background color of the disabled button.
--forge-button-disabled-border-colorThe border color of the disabled button.
--forge-button-disabled-shadowThe shadow of the disabled button.
--forge-button-dense-heightThe height of the dense button.
--forge-button-pill-shapeThe shape of the pill button.
--forge-button-pill-padding-inlineThe inline padding of the pill button.
Methods
NameReturnsDescription
click()void
focus(options)void

Keyboard interaction

Every button must be reachable by keyboard, with a visible focus indicator, and pressing Space or Enter while focused must activate it the same as a mouse click.

Accessible name

Give every button a visible label describing the action it performs. When there’s no visible text — an icon-only button — provide one via aria-label instead.

Contrast

Button text and its background must meet WCAG contrast requirements.

Loading Forge chat…