Sidebar

Zwijany pasek boczny aplikacji z nagłówkiem, grupami, menu, plakietkami, szyną i wciętym obszarem treści — Sidebar z shadcn/ui dla Angulara.

Dostępny w
  • Angular: dostępny
  • Vue: dostępny
  • React: dostępny
  • React Native: jeszcze niedostępny

Użycie

Library
  • 3
Developer

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

Import

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";

Dokumentacja API

SoneSidebarComponentKomponent

`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.

Selektor
sone-sidebar
Wejścia
NazwaTyp Domyślnie
sideSoneSidebarSide"left"
variantSoneSidebarVariant"sidebar"
collapsibleSoneSidebarCollapsible"none"

SoneSidebarContentDirectiveDyrektywa

Selektor
[soneSidebarContent], sone-sidebar-content

SoneSidebarFooterDirectiveDyrektywa

Selektor
[soneSidebarFooter], sone-sidebar-footer

SoneSidebarGroupActionDirectiveDyrektywa

Selektor
button[soneSidebarGroupAction]

SoneSidebarGroupContentDirectiveDyrektywa

Selektor
[soneSidebarGroupContent]

SoneSidebarGroupDirectiveDyrektywa

Selektor
[soneSidebarGroup], sone-sidebar-group
Wejścia
NazwaTyp Domyślnie
tone

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

SoneSidebarGroupTone"default"

SoneSidebarGroupLabelDirectiveDyrektywa

Selektor
[soneSidebarGroupLabel]
Wejścia
NazwaTyp Domyślnie
variant

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

SoneSidebarGroupLabelVariant"default"

SoneSidebarHeaderDirectiveDyrektywa

Selektor
[soneSidebarHeader], sone-sidebar-header

SoneSidebarInsetDirectiveDyrektywa

Selektor
[soneSidebarInset]

SoneSidebarMenuActionDirectiveDyrektywa

Selektor
button[soneSidebarMenuAction]
Wejścia
NazwaTyp Domyślnie
showOnHoverbooleanfalse

SoneSidebarMenuBadgeDirectiveDyrektywa

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

SoneSidebarMenuButtonDirectiveDyrektywa

Selektor
button[soneSidebarMenuButton], a[soneSidebarMenuButton]
Wejścia
NazwaTyp Domyślnie
sizeSoneSidebarMenuButtonSize"default"
variant

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

SoneSidebarMenuButtonVariant"default"
isActivebooleanfalse

SoneSidebarMenuDirectiveDyrektywa

Selektor
ul[soneSidebarMenu]
Wejścia
NazwaTyp Domyślnie
orientation

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

SoneSidebarMenuOrientation"vertical"

SoneSidebarMenuItemDirectiveDyrektywa

Selektor
li[soneSidebarMenuItem]

SoneSidebarMenuSkeletonDirectiveDyrektywa

Selektor
[soneSidebarMenuSkeleton]
Wejścia
NazwaTyp Domyślnie
showIconbooleanfalse

SoneSidebarMenuSubButtonDirectiveDyrektywa

Selektor
a[soneSidebarMenuSubButton], button[soneSidebarMenuSubButton]
Wejścia
NazwaTyp Domyślnie
sizeSoneSidebarMenuSubButtonSize"md"
isActivebooleanfalse

SoneSidebarMenuSubDirectiveDyrektywa

Selektor
ul[soneSidebarMenuSub]

SoneSidebarMenuSubItemDirectiveDyrektywa

Selektor
li[soneSidebarMenuSubItem]

SoneSidebarMenuTooltipDirectiveDyrektywa

Selektor
[soneSidebarMenuTooltip]
Wejścia
NazwaTyp Domyślnie
soneTooltipstring""
soneTooltipAlignTooltipAlign"center"
soneTooltipArrowbooleantrue
soneTooltipDisabledbooleanfalse
soneTooltipShowDelay—SHOW_DELAY_MS
soneTooltipSideTooltipSide | null"right"

SoneSidebarRailDirectiveDyrektywa

Selektor
[soneSidebarRail]
Wejścia
NazwaTyp Domyślnie
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`

SoneSidebarSeparatorDirectiveDyrektywa

Selektor
[soneSidebarSeparator], sone-sidebar-separator

SoneSidebarTriggerDirectiveDyrektywa

Selektor
button[soneSidebarTrigger]

SoneSidebarWrapperDirectiveDyrektywa

⌘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.

Selektor
[soneSidebarWrapper], sone-sidebar-wrapper
Wejścia
NazwaTyp Domyślnie
sidebarWidthstring | nullnull
sidebarWidthIconstring | nullnull