Sina UI

Overlays

Account menu

The avatar at the end of a top bar. It opens a menu with who's signed in, the organizations they can switch between, your own items and signing out, so organization switching doesn't need a control of its own.

Installation

npx sinaui add account-menu

Examples

With organizations

Open it, switch between three libraries, or add a new one. Account settings is an item passed in as children.

<script lang="ts">
	import { Settings01Icon } from '@hugeicons/core-free-icons';
	import AccountMenu from '#lib/ui/AccountMenu.svelte';
	import Icon from '#lib/ui/Icon.svelte';
	import * as Dropdown from '#lib/ui/dropdown/index.js';
	import { toast } from '#lib/ui/toast/index.js';

	const orgs = [
		{ id: 'baghdad', name: 'House of Wisdom, Baghdad' },
		{ id: 'cordoba', name: 'Library of Córdoba' },
		{ id: 'fez', name: 'Al-Qarawiyyin, Fez' }
	];
	let org = $state('baghdad');
</script>

<AccountMenu
	user={{ name: 'Fatima al-Fihri', email: 'fatima@qarawiyyin.example' }}
	{orgs}
	{org}
	onorg={(o) => {
		org = o.id;
		toast(`Switched to ${o.name}.`);
	}}
	onneworg={() => toast('A new organization would be created here.')}
	onsignout={() => toast('Signed out.')}
	theme
>
	<Dropdown.Item onselect={() => toast('Account settings would open here.')}>
		<Icon icon={Settings01Icon} /> Account settings
	</Dropdown.Item>
</AccountMenu>

Props

PropTypeDefault
user{ name, email?, image? } (required)
orgs{ id, name }[][]
orgstring: the current organization, ticked
onorg(org) => void
onneworg() => void: shows “New organization”
childrenSnippet: your own Dropdown items
onsignout() => void: shows “Sign out”
themeboolean: a light/dark switch under the namefalse
labels{ account, organizations, newOrg, signOut, darkTheme, lightTheme }English

Accessibility

  • The button is named “Account: ” and the person's name, and opens a menu like Dropdown.
  • The current organization is marked with aria-current as well as the tick.
  • The name, email and section title are plain text in the menu, never focus stops.
Introduction
Theming
Changelog
Button
Action button
Confirm button
Copy button
Hold to confirm
Split button
Theme toggle
Calendar
Checkbox
Color picker
Combobox
Date picker
Date range picker
File drop
Form
Input
Mention input
Multi select
Number field
OTP input
Password input
Phone input
Radio cards
Radio group
Rich text editor
Search field
Segmented control
Select
Signature pad
Slider
Switch
Tag input
Upload
Wheel picker
Textarea
Time field
Toggle group
Toolbar
Alert dialog
Command palette
Context menu
Dialog
Drawer
Account menu
Dropdown
Hover card
Popover
Tooltip
Announcement bar
Alert
Empty state
Meter
Progress
Rolling number
Skeleton
Spinner
Toast
Avatar
Avatar group
Badge
Card
Carousel
Chart
Sparkline
World map
Chat
Code block
Data table
Folder
Kbd
Mind map
Resizable panels
Scroll area
Separator
Sortable
Table
Tag group
Virtual list
Audio player
Image
Image compare
Video
Visualizer
Breadcrumb
File tree
Docs navigation
Menubar
Navigation menu
Pagination
Sidebar layout
Stat tabs
Stepper
Tabs
Table of contents
Alarm clock
Clock
Dynamic island
Fluid orb
Hourglass
Stopwatch
Timer
AI chat
AI media
Auth
Board
Booking
Dashboard
Docs
File explorer
Messaging
Notifications
Settings
Studio
Team
Overview
Pricing
Agent chat
Calendar
Voice agent
Mail inbox
CMS
Blog
Marketing site
E-commerce
AI agents
SaaS landing page
SaaS app
Accordion
Dark theme
Light theme