Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

SidebarUserCard

  • Stable
  • WCAG 2.2 evidence
  • RTL

The signed-in person at the bottom of a Sidebar: avatar, name and email, opening the account menu. The whole card is one React Aria menu trigger (aria-haspopup, aria-expanded): Enter, Space and the arrow keys open the library Menu, Escape closes it and returns focus (WCAG 2.1.1, 2.4.3, 4.1.2). Its name is the visible name and email plus the presence text (2.5.3). In the collapsed rail only the avatar shows and a tooltip gives the name; the card stays at least 40 x 52 px (2.5.8). Consumer duties: menu item wording; a Sign out item.

import { SidebarUserCard } from "@nexera-ui/react";
Loading example…
5
examples
29
props
7
live controls
1
platform
10
WCAG criteria
1
block uses it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
presence
variant
isCollapsed
children
defaultOpen
placement
isDisabled
Generated code
import { SidebarUserCard } from "@nexera-ui/react";

<SidebarUserCard />

Examples 4

The same examples as Storybook, rendered live. Open Code to copy one.

Menu open

The account menu open (it opens above the card).

Loading example…

Variants and rail

Figma Variant=Light and Collapsed=True (avatar only; focus or hover it for the name).

Loading example…

Long text

Long names and addresses wrap.

Loading example…

Right to left

Right to left: the presence dot and the ellipsis move to the other side.

Loading example…

Props 29

Press "Try it" on a card to load that prop into the playground.

29 props shown

name*Nexera
string

The signed-in person's name. Part of the trigger's name.

Default –
emailNexera
string

Their email address. Shown under the name when provided.

Default –
initials*Nexera
string

One or two letters for the avatar.

Default –
presenceNexera
"online" | "away" | "busy" | "offline"

Availability shown as the avatar dot. Shown when provided, and announced as text with the name, so it is not conveyed by colour alone.

Default –
presenceLabelNexera
string

Announced text of presence. Translate it for your locale.

Default "Online", "Away", "Busy" or "Offline"
variantNexera
"brand" | "light"

Colour scheme.

Default the enclosing Sidebar's variant, else "brand"
isCollapsedNexera
boolean

Show only the avatar; the name moves to a tooltip.

Default the enclosing Sidebar's collapsed state, else false
children*Nexera
ReactNode

The account menu: MenuItem elements (Profile, Settings, Sign out, …), optionally in MenuSections.

Default –
onActionNexera
(key: Key) => void

Called with the id of the menu item the user activates.

Default –
isOpenNexera
boolean

Whether the menu is open (controlled). Use with onOpenChange.

Default –
defaultOpenNexera
boolean

Whether the menu is open on first render (uncontrolled).

Default false
onOpenChangeNexera
(isOpen: boolean) => void

Called when the menu opens or closes.

Default –
placementNexera
"bottom" | "bottom left" | "bottom right" | "bottom start" | "bottom end" | "top" | "top left" | "top right" | "top start" | "top end" | "left" | "left top" | "left bottom" | "start" | "start top" | "start bottom" | "right" | "right top" | "right bottom" | "end" | "end top" | "end bottom"

Where the menu opens. It flips to stay in the viewport.

Default "top start", or "end bottom" when collapsed
classNameNexera
string

Extra classes for the trigger, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style for the trigger.

Default –
isDisabledReact Aria
boolean

Whether the button is disabled.

Default –
onPressReact Aria
(e: PressEvent) => void

Handler that is called when the press is released over the target.

Default –
onPressStartReact Aria
(e: PressEvent) => void

Handler that is called when a press interaction starts.

Default –
onPressEndReact Aria
(e: PressEvent) => void

Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.

Default –
onPressChangeReact Aria
(isPressed: boolean) => void

Handler that is called when the press state changes.

Default –
onPressUpReact Aria
(e: PressEvent) => void

Handler that is called when a press is released over the target, regardless of whether it started on the target or not.

Default –
autoFocusReact Aria
boolean

Whether the element should receive focus on render.

Default –
typeReact Aria
"button" | "submit" | "reset"

The behavior of the button when used in an HTML form.

Default 'button'
formReact Aria
string

The <form> element to associate the button with. The value of this attribute must be the id of a <form> in the same document. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#form).

Default –
valueReact Aria
string

The value associated with the button's name when it's submitted with the form data.

Default –
idReact Aria
string

The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).

Default –
aria-labelReact Aria
string

Defines a string value that labels the current element.

Default –
aria-labelledbyReact Aria
string

Identifies the element (or elements) that labels the current element.

Default –
aria-describedbyReact Aria
string

Identifies the element (or elements) that describes the object.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

7 direct · 3 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.4.4Resize TextLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 1.4.13Content on Hover or FocusLevel AA · tested directly
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.3Focus OrderLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · supporting test
  • 2.5.3Label in NameLevel A · tested directly
  • 4.1.2Name, Role, ValueLevel A · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-disabled
  • data-hovered
  • data-pressed
Usage
<SidebarUserCard className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

Related components