On this page
@addTagHelper *, Webority.Ui.RazorThe list
A labelled group of accounts, where the current one carries a tick and is marked for screen readers.
Accounts with the current one marked
Switch account
Every option
Every value of every prop, one cell each.
accounts
no app-account children (default): renders nothing
app-account: one row
Switch account
app-account description: a line under the name
Switch account
app-account badge: a trailing pill
Switch account
app-account photo: initials without one
Switch account
app-account href: a link row
Switch account
currentId
current-id="acme"
Switch account
current-id="globex"
Switch account
current-id="initech"
Switch account
current-id="none": falls back to the first account
Switch account
onSelect
onSelect (React): fires with the account; here a button with data-account-id
Switch account
label
label="Switch account" (default)
Switch account
label="Choose a company"
Choose a company
linkComponent
linkComponent (React): a router link for href rows; here a plain link
Switch account
Guidance
What to do, and what to avoid.
Use it when
- A person signed in to more than one account, company or organisation, and needs to see which one is current.
- The switcher sits in the user menu's section slot of AppShell.
Reach for something else when
- You are switching the workspace or tenant in the chrome. → AppWorkspaceSwitcher
- You need a flat list of actions behind a trigger. → AppDropdown
- You are picking a value into a form field. → AppSelect
Offer switching only with several accounts
Do
Switch account
The current account is ticked, and each other account is one row to switch to.
Avoid
Switch account
A list of one account. There is nothing to switch to, so the section does not earn its place.
Reference
Try every prop, read the full list, and check keyboard and screen reader behaviour.
3 props. The 2 most used come first.
Used on most screens 2 props
| Prop | Type | Default | Description |
|---|---|---|---|
| current-iddefault - | string | - | The id of the current account. It sets the tick and aria-current, and falls back to the first account when it matches none. |
| labeldefault Switch account | string | Switch account | The heading above the list. It is also the group's accessible name. |
Less common 1 props
| Prop | Type | Default | Description |
|---|---|---|---|
| (app-account children)default - | - | - | The accounts a person can switch to, one app-account child each. |
Screen reader
3 notes- The list is a group named by label.
- The current account carries aria-current and a tick, so the state is not shown by colour alone.
- A row with an href is a link; a row without one is a button.
Do and avoid
1 pairsOffer switching only with several accounts
Do
Switch account
The current account is ticked, and each other account is one row to switch to.
Avoid
Switch account
A list of one account. There is nothing to switch to, so the section does not earn its place.