Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Variants

Keep the split on the main action's fill, and use danger only when the main action destroys something.

Outline and danger
Show code
<app-split-button label="Reply" variant="Outline">
    <app-split-button-item icon="users">Reply all</app-split-button-item>
    <app-split-button-item icon="arrow-right">Forward</app-split-button-item>
</app-split-button>
<app-split-button label="Archive" tone="Danger">
    <app-split-button-item icon="box-seam">Archive</app-split-button-item>
    <app-split-button-item icon="trash-2" tone="Tone.Danger">Delete</app-split-button-item>
</app-split-button>

Alternatives in the menu

Keep the menu to variations of the main action; unrelated actions belong in a dropdown beside the split.

Reply and danger menus
Show code
<app-split-button label="Reply">
    <app-split-button-item icon="users">Reply all</app-split-button-item>
    <app-split-button-item icon="arrow-right">Forward</app-split-button-item>
    <hr class="dropdown-divider" />
    <app-split-button-item icon="box-seam">Archive</app-split-button-item>
    <app-split-button-item icon="trash-2" tone="Tone.Danger">Delete</app-split-button-item>
</app-split-button>

Every option

Every value of every prop, one cell each.

label

label: the main button's text, also the group's accessible name

items

app-split-button-item image="...": an image before the item's text
app-split-button-item href="#reply": the item is a link (React: to)
(default): no rows, the chevron opens an empty menu
app-split-button-item: the save menu, with a divider and a shortcut
app-split-button-item: the reply menu, two rows with icons
app-split-button-item tone="danger": the danger menu, a row in the danger tone

onClick

onClick: React only, a callback run when the main button is pressed

href

(default): no href, the main button is a button
href="#save": the main button is a link
Reply

type

type="button" (default)
type="submit"
type="reset"

tone

tone="primary" (default)
tone="success"
tone="warning"
tone="danger"
tone="info"
tone="neutral"

variant

variant="solid" (default)
variant="soft"
variant="outline"
variant="ghost"
variant="link"
variant="glass"

size

size="sm"
size="md" (default)
size="lg"

disabled

disabled="false" (default): both halves enabled
disabled="true": both halves disabled

loading

loading="false" (default): no spinner
loading="true": the spinner shows on the main button and both halves are disabled

left-icon

(default): no icon before the label
left-icon="file-text": a library icon before the label

shortcut

(default): no key chip
shortcut="D": a key chip after the label runs the main action

menu-label

menu-label="More actions" (default): the accessible name of the chevron
menu-label="Actions": the chevron is named Actions

align

align="end" (default): the menu lines up with the end edge
align="start": the menu lines up with the start edge

linkComponent

linkComponent: React only; Razor items take href, a plain link

className

className: React only; Razor takes a plain class attribute

Guidance

What to do, and what to avoid.

Use it when

  • A primary action with two or three close alternatives (save and close, reply all).
  • A default the user can change without leaving the screen.

Reach for something else when

  • Several equal actions. → AppButtonGroup
  • A menu with no main action. → AppDropdown

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

primary success warning danger info neutral
solid soft outline ghost link glass
sm md lg
button submit reset
end start
save reply danger
React, generated from the controls
<AppSplitButton label="Save" onClick={save} items={items} />
Razor, the same props
<app-split-button label="Save">…items…</app-split-button>

12 props. The 4 most used come first.

Used on most screens 4 props

PropTypeDefaultDescription
labeldefault - string - The main button's text, also the group's accessible name.
tonedefault primary primary | success | warning | danger | info | neutral primary Both halves share it.
variantdefault solid solid | soft | outline | ghost | link | glass solid Both halves share it.
sizedefault md sm | md | lg md The size of both halves.

Less common 8 props

PropTypeDefaultDescription
typedefault button button | submit | reset button The main button's type.
hrefdefault - string - Makes the main button a link.
disableddefault false bool false Disables both halves.
loadingdefault false bool false Shows the spinner on the main button and disables both halves.
left-icondefault - string - The icon name before the main label.
shortcutdefault - string - The key that runs the main action, drawn as a key chip after the label.
menu-labeldefault More actions string More actions The accessible name of the chevron.
aligndefault end start | end end Which edge the menu lines up with.

Screen reader

3 notes
  • The two halves are one group (role group) named by label.
  • The chevron is named by menuLabel; Enter or Space on it opens the menu, arrows move, Escape closes it and returns focus to the chevron.
  • Disabled or loading disables both halves.