Sidebar

Una barra laterale dell'applicazione comprimibile con intestazione, gruppi, menu, badge, una barra compatta e un'area di contenuto inserita: il Sidebar di shadcn/ui per Angular.

Disponibile in
  • Angular: disponibile
  • Vue: disponibile
  • React: disponibile
  • React Native: non ancora disponibile

Utilizzo

Library
  • 3
Developer

Use the toggle (or drag the rail) to collapse the sidebar to icons.

Importazione

ts
import {
  SoneSidebarComponent,
  SoneSidebarContentDirective,
  SoneSidebarFooterDirective,
  SoneSidebarGroupActionDirective,
  SoneSidebarGroupContentDirective,
  SoneSidebarGroupDirective,
  SoneSidebarGroupLabelDirective,
  SoneSidebarHeaderDirective,
  SoneSidebarInsetDirective,
  SoneSidebarMenuActionDirective,
  SoneSidebarMenuBadgeDirective,
  SoneSidebarMenuButtonDirective,
  SoneSidebarMenuDirective,
  SoneSidebarMenuItemDirective,
  SoneSidebarMenuSkeletonDirective,
  SoneSidebarMenuSubButtonDirective,
  SoneSidebarMenuSubDirective,
  SoneSidebarMenuSubItemDirective,
  SoneSidebarMenuTooltipDirective,
  SoneSidebarRailDirective,
  SoneSidebarSeparatorDirective,
  SoneSidebarTriggerDirective,
  SoneSidebarWrapperDirective,
} from "@surface-one/angular/sidebar";

Riferimento API

SoneSidebarComponentComponente

`sidebar.css` is global, not component-scoped: the app shell must be styled before Angular boots (WKWebView cold-launch FOUC fix, see app-shell). `collapsible` defaults to `"none"`, not spartan's `"offcanvas"`: this same part is also the static section rail in the Settings dialog, which must not collapse whenever the app-wide sidebar does.

Selettore
sone-sidebar
Input
NomeTipo Predefinito
sideSoneSidebarSide"left"
variantSoneSidebarVariant"sidebar"
collapsibleSoneSidebarCollapsible"none"

SoneSidebarContentDirectiveDirettiva

Selettore
[soneSidebarContent], sone-sidebar-content

SoneSidebarFooterDirectiveDirettiva

Selettore
[soneSidebarFooter], sone-sidebar-footer

SoneSidebarGroupActionDirectiveDirettiva

Selettore
button[soneSidebarGroupAction]

SoneSidebarGroupContentDirectiveDirettiva

Selettore
[soneSidebarGroupContent]

SoneSidebarGroupDirectiveDirettiva

Selettore
[soneSidebarGroup], sone-sidebar-group
Input
NomeTipo Predefinito
tone

`danger` tints the group's label and rows red (a developer or destructive section).

SoneSidebarGroupTone"default"

SoneSidebarGroupLabelDirectiveDirettiva

Selettore
[soneSidebarGroupLabel]
Input
NomeTipo Predefinito
variant

`destructive` sets the label in the danger colour (pair it with `destructive` menu buttons).

SoneSidebarGroupLabelVariant"default"

SoneSidebarHeaderDirectiveDirettiva

Selettore
[soneSidebarHeader], sone-sidebar-header

SoneSidebarInsetDirectiveDirettiva

Selettore
[soneSidebarInset]

SoneSidebarMenuActionDirectiveDirettiva

Selettore
button[soneSidebarMenuAction]
Input
NomeTipo Predefinito
showOnHoverbooleanfalse

SoneSidebarMenuBadgeDirectiveDirettiva

Selettore
[soneSidebarMenuBadge], sone-sidebar-menu-badge

SoneSidebarMenuButtonDirectiveDirettiva

Selettore
button[soneSidebarMenuButton], a[soneSidebarMenuButton]
Input
NomeTipo Predefinito
sizeSoneSidebarMenuButtonSize"default"
variant

`destructive`: danger text, and the danger tint on hover and when active.

SoneSidebarMenuButtonVariant"default"
isActivebooleanfalse

SoneSidebarMenuDirectiveDirettiva

Selettore
ul[soneSidebarMenu]
Input
NomeTipo Predefinito
orientation

`horizontal` lays the rows out as a wrapping row of content-width buttons (a narrow-screen nav).

SoneSidebarMenuOrientation"vertical"

SoneSidebarMenuItemDirectiveDirettiva

Selettore
li[soneSidebarMenuItem]

SoneSidebarMenuSkeletonDirectiveDirettiva

Selettore
[soneSidebarMenuSkeleton]
Input
NomeTipo Predefinito
showIconbooleanfalse

SoneSidebarMenuSubButtonDirectiveDirettiva

Selettore
a[soneSidebarMenuSubButton], button[soneSidebarMenuSubButton]
Input
NomeTipo Predefinito
sizeSoneSidebarMenuSubButtonSize"md"
isActivebooleanfalse

SoneSidebarMenuSubDirectiveDirettiva

Selettore
ul[soneSidebarMenuSub]

SoneSidebarMenuSubItemDirectiveDirettiva

Selettore
li[soneSidebarMenuSubItem]

SoneSidebarMenuTooltipDirectiveDirettiva

Selettore
[soneSidebarMenuTooltip]
Input
NomeTipo Predefinito
soneTooltipstring""
soneTooltipAlignTooltipAlign"center"
soneTooltipArrowbooleantrue
soneTooltipDisabledbooleanfalse
soneTooltipShowDelay—SHOW_DELAY_MS
soneTooltipSideTooltipSide | null"right"

SoneSidebarRailDirectiveDirettiva

Selettore
[soneSidebarRail]
Input
NomeTipo Predefinito
resizeLabel—$localize`Resize sidebar`
toggleLabel—$localize`Toggle sidebar`
expandedHint—$localize`Click to collapse · drag to resize · ⌥-click to reset width`
collapsedHint—$localize`Click to expand`

SoneSidebarSeparatorDirectiveDirettiva

Selettore
[soneSidebarSeparator], sone-sidebar-separator

SoneSidebarTriggerDirectiveDirettiva

Selettore
button[soneSidebarTrigger]

SoneSidebarWrapperDirectiveDirettiva

⌘B/Ctrl+B also toggles Bold in `sone-markdown-editor`, which calls `preventDefault()` on the textarea before this document-level listener runs, so it stands down there and never fires inside any editable field.

Selettore
[soneSidebarWrapper], sone-sidebar-wrapper
Input
NomeTipo Predefinito
sidebarWidthstring | nullnull
sidebarWidthIconstring | nullnull