Sidebar

可折叠的应用侧边栏,包含头部、分组、菜单、徽章、导轨和内嵌内容区——Angular 版的 shadcn/ui Sidebar。

可用框架
  • Angular: 可用
  • Vue: 可用
  • React: 可用
  • React Native: 暂不可用

用法

Library
  • 3
Developer

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

导入

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

API 参考

SoneSidebarComponent组件

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

选择器
sone-sidebar
输入
名称类型 默认值
sideSoneSidebarSide"left"
variantSoneSidebarVariant"sidebar"
collapsibleSoneSidebarCollapsible"none"

SoneSidebarContentDirective指令

选择器
[soneSidebarContent], sone-sidebar-content

SoneSidebarFooterDirective指令

选择器
[soneSidebarFooter], sone-sidebar-footer

SoneSidebarGroupActionDirective指令

选择器
button[soneSidebarGroupAction]

SoneSidebarGroupContentDirective指令

选择器
[soneSidebarGroupContent]

SoneSidebarGroupDirective指令

选择器
[soneSidebarGroup], sone-sidebar-group
输入
名称类型 默认值
tone

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

SoneSidebarGroupTone"default"

SoneSidebarGroupLabelDirective指令

选择器
[soneSidebarGroupLabel]
输入
名称类型 默认值
variant

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

SoneSidebarGroupLabelVariant"default"

SoneSidebarHeaderDirective指令

选择器
[soneSidebarHeader], sone-sidebar-header

SoneSidebarInsetDirective指令

选择器
[soneSidebarInset]

SoneSidebarMenuActionDirective指令

选择器
button[soneSidebarMenuAction]
输入
名称类型 默认值
showOnHoverbooleanfalse

SoneSidebarMenuBadgeDirective指令

选择器
[soneSidebarMenuBadge], sone-sidebar-menu-badge

SoneSidebarMenuButtonDirective指令

选择器
button[soneSidebarMenuButton], a[soneSidebarMenuButton]
输入
名称类型 默认值
sizeSoneSidebarMenuButtonSize"default"
variant

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

SoneSidebarMenuButtonVariant"default"
isActivebooleanfalse

SoneSidebarMenuDirective指令

选择器
ul[soneSidebarMenu]
输入
名称类型 默认值
orientation

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

SoneSidebarMenuOrientation"vertical"

SoneSidebarMenuItemDirective指令

选择器
li[soneSidebarMenuItem]

SoneSidebarMenuSkeletonDirective指令

选择器
[soneSidebarMenuSkeleton]
输入
名称类型 默认值
showIconbooleanfalse

SoneSidebarMenuSubButtonDirective指令

选择器
a[soneSidebarMenuSubButton], button[soneSidebarMenuSubButton]
输入
名称类型 默认值
sizeSoneSidebarMenuSubButtonSize"md"
isActivebooleanfalse

SoneSidebarMenuSubDirective指令

选择器
ul[soneSidebarMenuSub]

SoneSidebarMenuSubItemDirective指令

选择器
li[soneSidebarMenuSubItem]

SoneSidebarMenuTooltipDirective指令

选择器
[soneSidebarMenuTooltip]
输入
名称类型 默认值
soneTooltipstring""
soneTooltipAlignTooltipAlign"center"
soneTooltipArrowbooleantrue
soneTooltipDisabledbooleanfalse
soneTooltipShowDelay—SHOW_DELAY_MS
soneTooltipSideTooltipSide | null"right"

SoneSidebarRailDirective指令

选择器
[soneSidebarRail]
输入
名称类型 默认值
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`

SoneSidebarSeparatorDirective指令

选择器
[soneSidebarSeparator], sone-sidebar-separator

SoneSidebarTriggerDirective指令

选择器
button[soneSidebarTrigger]

SoneSidebarWrapperDirective指令

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

选择器
[soneSidebarWrapper], sone-sidebar-wrapper
输入
名称类型 默认值
sidebarWidthstring | nullnull
sidebarWidthIconstring | nullnull