Skip to content

Side Nav Item

@astryxdesign/core v0.7.1 · SideNavItem

Props ​

PropTypeDefaultDescription
labelstring—Visible name of the item. Becomes the accessible name of the icon-only row and of the collapsed popover. Required.
hrefstring—Navigation target URL. Without it the row is a button that only emits click.
asNavLinkComponent'a'Custom link root component, such as RouterLink. It receives the address as to as well. Used only when there is an address.
targetstring—Link target. A new-window target also adds noopener noreferrer.
relstring—Link rel. Merged with the noopener noreferrer that a new-window target adds.
iconClassstring—Icon before the label, given as a CSS icon class such as i-carbon-home. An item without an icon is left out while the rail is collapsed.
selectedIconClassstring—Icon used instead of iconClass while the item is selected.
isSelectedbooleanfalseWhether this is the current page. Sets aria-current="page" and the selected styles.
isDisabledbooleanfalseWhether the item is disabled. Blocks the default action and emits nothing.
size'sm' | 'md' | 'lg''md'Height and horizontal padding of the row.
collapsibleboolean | { defaultIsCollapsed?: boolean, isCollapsed?: boolean }—Whether the children can be folded. Left unset, a row with children folds. false keeps them open. The object form sets the starting or the controlled state.

Events ​

  • click(event: MouseEvent): fires when the row is clicked. A disabled item blocks the default action and emits nothing.

Slots ​

  • default: child items. A row with children folds them into a group.
  • icon: icon element before the label. An alternative to iconClass.
  • selectedIcon: icon element used while the item is selected. Falls back to icon.
  • end: content at the trailing edge of the row, such as a badge or a count.