User Panel
The strip at the foot of a sidebar: the signed-in user and their mute, deafen and settings controls.
Use it once per screen, pinned to the bottom of the navigation column, for the controls that belong to the person and not to the page: mute, deafen, open settings. It is the place a reader looks to check which account they are in.
Compose it from an avatar, UserPanelInfo and a UserPanelActions row of UserPanelButtons.
newt-user-panel"use client"
import * as React from "react"
import { Avatar } from "@/registry/bases/newt/ui/avatar"
import {
StatusDot,
StatusIndicator,
} from "@/registry/bases/newt/ui/status-indicator"
import {
UserPanel,
UserPanelActions,
UserPanelButton,
UserPanelInfo,
} from "@/registry/bases/newt/ui/user-panel"
export default function UserPanelDemo() {
const [muted, setMuted] = React.useState(true)
const [deafened, setDeafened] = React.useState(false)
return (
<UserPanel className="w-60">
<StatusIndicator>
<Avatar size="sm">A</Avatar>
<StatusDot status="online" />
</StatusIndicator>
<UserPanelInfo name="ada" status={muted ? "Muted" : "Online"} />
<UserPanelActions>
<UserPanelButton
icon="microphone"
label="Mute"
pressed={muted}
onPressedChange={setMuted}
/>
<UserPanelButton
icon="headphones"
label="Deafen"
pressed={deafened}
onPressedChange={setDeafened}
/>
<UserPanelButton icon="settings" label="User settings" />
</UserPanelActions>
</UserPanel>
)
}<script setup lang="ts">
import { ref } from "vue"
import { Avatar } from "~~/registry/bases/newt/ui/avatar"
import {
StatusDot,
StatusIndicator,
} from "~~/registry/bases/newt/ui/status-indicator"
import {
UserPanel,
UserPanelActions,
UserPanelButton,
UserPanelInfo,
} from "~~/registry/bases/newt/ui/user-panel"
const muted = ref(true)
const deafened = ref(false)
</script>
<template>
<UserPanel class="w-60">
<StatusIndicator>
<Avatar size="sm">A</Avatar>
<StatusDot status="online" />
</StatusIndicator>
<UserPanelInfo name="ada" :status="muted ? 'Muted' : 'Online'" />
<UserPanelActions>
<UserPanelButton v-model:pressed="muted" icon="microphone" label="Mute" />
<UserPanelButton
v-model:pressed="deafened"
icon="headphones"
label="Deafen"
/>
<UserPanelButton icon="settings" label="User settings" />
</UserPanelActions>
</UserPanel>
</template>Installation
npx newtui@latest add user-panelnpx shadcn@latest add @newtui/user-panelnpx shadcn-vue@latest add @newtui/user-panelpnpm dlx newtui@latest add user-panelpnpm dlx shadcn@latest add @newtui/user-panelpnpm dlx shadcn-vue@latest add @newtui/user-panelyarn dlx newtui@latest add user-panelyarn dlx shadcn@latest add @newtui/user-panelyarn dlx shadcn-vue@latest add @newtui/user-panelbunx newtui@latest add user-panelbunx shadcn@latest add @newtui/user-panelbunx shadcn-vue@latest add @newtui/user-paneldeno run -A npm:newtui@latest add user-paneldeno run -A npm:shadcn@latest add @newtui/user-paneldeno run -A npm:shadcn-vue@latest add @newtui/user-panelvlx newtui@latest add user-panelvlx shadcn@latest add @newtui/user-panelvlx shadcn-vue@latest add @newtui/user-panelvp dlx newtui@latest add user-panelvp dlx shadcn@latest add @newtui/user-panelvp dlx shadcn-vue@latest add @newtui/user-panelnubx newtui@latest add user-panelnubx shadcn@latest add @newtui/user-panelnubx shadcn-vue@latest add @newtui/user-panelnlx newtui@latest add user-panelnlx shadcn@latest add @newtui/user-panelnlx shadcn-vue@latest add @newtui/user-panelupx newtui@latest add user-panelupx shadcn@latest add @newtui/user-panelupx shadcn-vue@latest add @newtui/user-panel- newtui
- shadcn
- npm
- pnpm
- yarn
- bun
- deno
- vlt
- vp
- nub
- ni
- upm
The shadcn CLI needs the @newtui registry in your components.json. Set it up.
Copy the source into your project
"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
/*
* The strip at the foot of a sidebar: who you are signed in as, and the two
* or three controls that follow you everywhere. Put the avatar first, then
* `UserPanelInfo`, then `UserPanelActions`.
*/
const UserPanel = React.forwardRef<
HTMLElement,
React.ComponentProps<"section">
>(({ className, "aria-label": label = "User controls", ...props }, ref) => (
<section
ref={ref}
aria-label={label}
className={cn(
"flex w-full items-center gap-2 rounded-[var(--newt-radius-md)] bg-newt-bg-base p-2",
className
)}
{...props}
/>
))
UserPanel.displayName = "UserPanel"
export interface UserPanelInfoProps extends React.ComponentProps<"div"> {
name: string
/** The quieter line under the name: a status, a tag, an activity. */
status?: string
}
const UserPanelInfo = React.forwardRef<HTMLDivElement, UserPanelInfoProps>(
({ className, name, status, ...props }, ref) => (
<div
ref={ref}
className={cn("flex min-w-0 flex-1 flex-col", className)}
{...props}
>
<span className="truncate text-sm font-semibold leading-[18px] text-newt-text-primary">
{name}
</span>
{status === undefined ? null : (
<span className="truncate text-xs leading-4 text-newt-text-muted">
{status}
</span>
)}
</div>
)
)
UserPanelInfo.displayName = "UserPanelInfo"
const UserPanelActions = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("flex shrink-0", className)} {...props} />
))
UserPanelActions.displayName = "UserPanelActions"
export type UserPanelIcon = "microphone" | "headphones" | "settings"
export interface UserPanelButtonProps extends Omit<
React.ComponentProps<"button">,
"children"
> {
icon: UserPanelIcon
/** The button's accessible name; it has no visible text. */
label: string
/**
* Makes the button a switch. On, the icon is struck through as well as
* recoloured, so the state does not rest on colour.
*/
pressed?: boolean
onPressedChange?: (pressed: boolean) => void
}
const UserPanelButton = React.forwardRef<
HTMLButtonElement,
UserPanelButtonProps
>(
(
{ className, icon, label, pressed, onPressedChange, onClick, ...props },
ref
) => (
<button
ref={ref}
type="button"
aria-label={label}
aria-pressed={pressed}
onClick={(event) => {
onClick?.(event)
if (!event.defaultPrevented && pressed !== undefined) {
onPressedChange?.(!pressed)
}
}}
className={cn(
"inline-flex h-8 w-8 items-center justify-center rounded-[var(--newt-radius-sm)] text-newt-text-secondary transition-colors duration-fast ease-newt hover:bg-newt-bg-hover hover:text-newt-text-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-newt-text-link aria-pressed:text-newt-danger",
className
)}
{...props}
>
<svg viewBox="0 0 16 16" aria-hidden="true" className="h-[18px] w-[18px]">
{icon === "microphone" ? (
<>
<path
fill="currentColor"
d="M8 1.5a2 2 0 0 0-2 2v4a2 2 0 0 0 4 0v-4a2 2 0 0 0-2-2Z"
/>
<path
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
d="M3.5 7.5a4.5 4.5 0 0 0 9 0M8 12v2.5"
/>
</>
) : icon === "headphones" ? (
<>
<path
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
d="M2.75 9.5V8a5.25 5.25 0 0 1 10.5 0v1.5"
/>
<rect x="2" y="9" width="3" height="5" rx="1" fill="currentColor" />
<rect
x="11"
y="9"
width="3"
height="5"
rx="1"
fill="currentColor"
/>
</>
) : (
<>
<circle
cx="8"
cy="8"
r="5.2"
fill="none"
stroke="currentColor"
strokeWidth="2.6"
strokeDasharray="2.2 1.88"
/>
<circle
cx="8"
cy="8"
r="2.4"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
/>
</>
)}
{pressed === true ? (
<path
fill="none"
stroke="currentColor"
strokeWidth="1.75"
strokeLinecap="round"
d="M2.5 2.5l11 11"
/>
) : null}
</svg>
</button>
)
)
UserPanelButton.displayName = "UserPanelButton"
export { UserPanel, UserPanelInfo, UserPanelActions, UserPanelButton }<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
/*
* The strip at the foot of a sidebar: who you are signed in as, and the two
* or three controls that follow you everywhere. Put the avatar first, then
* `UserPanelInfo`, then `UserPanelActions`. An `aria-label` passed to it
* replaces the default name of the region.
*/
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<section
aria-label="User controls"
:class="
cn(
'flex w-full items-center gap-2 rounded-[var(--newt-radius-md)] bg-newt-bg-base p-2',
props.class
)
"
>
<slot />
</section>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
name: string
/** The quieter line under the name: a status, a tag, an activity. */
status?: string
}>()
</script>
<template>
<div :class="cn('flex min-w-0 flex-1 flex-col', props.class)">
<span
class="truncate text-sm font-semibold leading-[18px] text-newt-text-primary"
>
{{ props.name }}
</span>
<span
v-if="props.status !== undefined"
class="truncate text-xs leading-4 text-newt-text-muted"
>
{{ props.status }}
</span>
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div :class="cn('flex shrink-0', props.class)"><slot /></div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import type { UserPanelIcon } from "."
const props = defineProps<{
class?: HTMLAttributes["class"]
icon: UserPanelIcon
/** The button's accessible name; it has no visible text. */
label: string
}>()
/**
* `v-model:pressed` makes the button a switch. On, the icon is struck through
* as well as recoloured, so the state does not rest on colour. Without it the
* button is a plain one and `click` is all it reports.
*/
const pressed = defineModel<boolean | undefined>("pressed", {
default: undefined,
})
function onClick() {
if (pressed.value !== undefined) pressed.value = !pressed.value
}
</script>
<template>
<button
type="button"
:aria-label="props.label"
:aria-pressed="pressed"
:class="
cn(
'inline-flex h-8 w-8 items-center justify-center rounded-[var(--newt-radius-sm)] text-newt-text-secondary transition-colors duration-fast ease-newt hover:bg-newt-bg-hover hover:text-newt-text-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-newt-text-link aria-pressed:text-newt-danger',
props.class
)
"
@click="onClick"
>
<svg viewBox="0 0 16 16" aria-hidden="true" class="h-[18px] w-[18px]">
<template v-if="props.icon === 'microphone'">
<path
fill="currentColor"
d="M8 1.5a2 2 0 0 0-2 2v4a2 2 0 0 0 4 0v-4a2 2 0 0 0-2-2Z"
/>
<path
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
d="M3.5 7.5a4.5 4.5 0 0 0 9 0M8 12v2.5"
/>
</template>
<template v-else-if="props.icon === 'headphones'">
<path
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
d="M2.75 9.5V8a5.25 5.25 0 0 1 10.5 0v1.5"
/>
<rect x="2" y="9" width="3" height="5" rx="1" fill="currentColor" />
<rect x="11" y="9" width="3" height="5" rx="1" fill="currentColor" />
</template>
<template v-else>
<circle
cx="8"
cy="8"
r="5.2"
fill="none"
stroke="currentColor"
stroke-width="2.6"
stroke-dasharray="2.2 1.88"
/>
<circle
cx="8"
cy="8"
r="2.4"
fill="none"
stroke="currentColor"
stroke-width="1.5"
/>
</template>
<path
v-if="pressed === true"
fill="none"
stroke="currentColor"
stroke-width="1.75"
stroke-linecap="round"
d="M2.5 2.5l11 11"
/>
</svg>
</button>
</template>export { default as UserPanel } from "./UserPanel.vue"
export { default as UserPanelInfo } from "./UserPanelInfo.vue"
export { default as UserPanelActions } from "./UserPanelActions.vue"
export { default as UserPanelButton } from "./UserPanelButton.vue"
export type UserPanelIcon = "microphone" | "headphones" | "settings"Update the import paths
The files import @/lib/utils and sibling components through the aliases in your components.json. Point them at wherever those live in your project.
No CLI, no components.json: paste this into Claude, Cursor, Copilot or any coding assistant and it adds User Panel to your React project by hand. The prompt carries the source of every file the CLI would write — this component's and those of the components it builds on — with the imports already pointed at the default aliases.
No CLI, no components.json: paste this into Claude, Cursor, Copilot or any coding assistant and it adds User Panel to your Vue project by hand. The prompt carries the source of every file the CLI would write — this component's and those of the components it builds on — with the imports already pointed at the default aliases.
Usage
import { UserPanel } from "@/components/ui/user-panel"
export function Example() {
return <UserPanel />
}<script setup lang="ts">
import { UserPanel, UserPanelInfo, UserPanelActions, UserPanelButton } from "@/components/ui/user-panel"
</script>
<template>
<UserPanel />
</template>API reference
UserPanelInfo
name?string
The account's display name.
stringstatus?string
The quieter line under the name: a status, a tag, an activity.
stringUserPanelButton
icon?"microphone" | "headphones" | "settings"
Which drawing the button carries.
"microphone" | "headphones" | "settings"label?string
The button's accessible name. It has no visible text.
stringpressed / v-model:pressed?boolean
Makes the button a switch and sets its state. Leave it out for a plain button.
booleanonPressedChange?(pressed: boolean) => void
React only. Called with the new state; Vue emits `update:pressed`.
(pressed: boolean) => voidUserPanel is a labelled region and UserPanelActions a plain row. Both take the attributes of the element they render.
Accessibility
The panel is a <section> named “User controls”; pass aria-label to rename or translate it. Every button is named by its label, since an icon alone says nothing to a screen reader. A switch carries aria-pressed, and when it is on the icon is struck through as well as turned red, so muted and unmuted differ in shape. Name a switch for what it does (“Mute”) and let the pressed state say whether it is on; do not swap the label to “Unmute”.
Translating labels lists every English default.
Tokens
User Panel reads its colours, radii and motion from the --newt-* tokens installed with the library. Override a token and every component that reads it follows, including this one — see the token layer. In the plain HTML and CSS distribution the same component is newt-user-panel.
--newt-radius-md--newt-bg-base--newt-text-primary--newt-text-muted--newt-radius-sm--newt-text-secondary--newt-duration-fast--newt-ease--newt-bg-hover--newt-text-link--newt-danger