Sidebar

Una barra lateral de aplicación plegable con encabezado, grupos, menús, insignias, un riel y un área de contenido insertada: el Sidebar de shadcn/ui para Angular.

Disponible en
  • Angular: disponible
  • Vue: disponible
  • React: disponible
  • React Native: aún no disponible

Uso

Library
  • 3
Developer

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

Importación

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

Referencia de la 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.

Selector
sone-sidebar
Inputs
NombreTipo Predeterminado
sideSoneSidebarSide"left"
variantSoneSidebarVariant"sidebar"
collapsibleSoneSidebarCollapsible"none"

SoneSidebarContentDirectiveDirectiva

Selector
[soneSidebarContent], sone-sidebar-content

SoneSidebarFooterDirectiveDirectiva

Selector
[soneSidebarFooter], sone-sidebar-footer

SoneSidebarGroupActionDirectiveDirectiva

Selector
button[soneSidebarGroupAction]

SoneSidebarGroupContentDirectiveDirectiva

Selector
[soneSidebarGroupContent]

SoneSidebarGroupDirectiveDirectiva

Selector
[soneSidebarGroup], sone-sidebar-group
Inputs
NombreTipo Predeterminado
tone

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

SoneSidebarGroupTone"default"

SoneSidebarGroupLabelDirectiveDirectiva

Selector
[soneSidebarGroupLabel]
Inputs
NombreTipo Predeterminado
variant

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

SoneSidebarGroupLabelVariant"default"

SoneSidebarHeaderDirectiveDirectiva

Selector
[soneSidebarHeader], sone-sidebar-header

SoneSidebarInsetDirectiveDirectiva

Selector
[soneSidebarInset]

SoneSidebarMenuActionDirectiveDirectiva

Selector
button[soneSidebarMenuAction]
Inputs
NombreTipo Predeterminado
showOnHoverbooleanfalse

SoneSidebarMenuBadgeDirectiveDirectiva

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

SoneSidebarMenuButtonDirectiveDirectiva

Selector
button[soneSidebarMenuButton], a[soneSidebarMenuButton]
Inputs
NombreTipo Predeterminado
sizeSoneSidebarMenuButtonSize"default"
variant

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

SoneSidebarMenuButtonVariant"default"
isActivebooleanfalse

SoneSidebarMenuDirectiveDirectiva

Selector
ul[soneSidebarMenu]
Inputs
NombreTipo Predeterminado
orientation

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

SoneSidebarMenuOrientation"vertical"

SoneSidebarMenuItemDirectiveDirectiva

Selector
li[soneSidebarMenuItem]

SoneSidebarMenuSkeletonDirectiveDirectiva

Selector
[soneSidebarMenuSkeleton]
Inputs
NombreTipo Predeterminado
showIconbooleanfalse

SoneSidebarMenuSubButtonDirectiveDirectiva

Selector
a[soneSidebarMenuSubButton], button[soneSidebarMenuSubButton]
Inputs
NombreTipo Predeterminado
sizeSoneSidebarMenuSubButtonSize"md"
isActivebooleanfalse

SoneSidebarMenuSubDirectiveDirectiva

Selector
ul[soneSidebarMenuSub]

SoneSidebarMenuSubItemDirectiveDirectiva

Selector
li[soneSidebarMenuSubItem]

SoneSidebarMenuTooltipDirectiveDirectiva

Selector
[soneSidebarMenuTooltip]
Inputs
NombreTipo Predeterminado
soneTooltipstring""
soneTooltipAlignTooltipAlign"center"
soneTooltipArrowbooleantrue
soneTooltipDisabledbooleanfalse
soneTooltipShowDelay—SHOW_DELAY_MS
soneTooltipSideTooltipSide | null"right"

SoneSidebarRailDirectiveDirectiva

Selector
[soneSidebarRail]
Inputs
NombreTipo Predeterminado
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`

SoneSidebarSeparatorDirectiveDirectiva

Selector
[soneSidebarSeparator], sone-sidebar-separator

SoneSidebarTriggerDirectiveDirectiva

Selector
button[soneSidebarTrigger]

SoneSidebarWrapperDirectiveDirectiva

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

Selector
[soneSidebarWrapper], sone-sidebar-wrapper
Inputs
NombreTipo Predeterminado
sidebarWidthstring | nullnull
sidebarWidthIconstring | nullnull