mbr/elm-chadcn/1.0.0

ChadCn.Sidebar

Provides sidebar components.

The implementation follows the shadcn Base UI structure and Nova defaults.

type Config msg

Describes a sidebar and its contents.

type Group msg

Describes a labeled collection of sidebar items.

type Item msg

Describes an interactive sidebar item.

type State
= Expanded
| Collapsed

Describes the persistent desktop sidebar state.

new : Config msg

Creates an empty sidebar configuration.

withFooter : Html msg -> Config msg -> Config msg

Adds custom footer content.

withHeader : Html msg -> Config msg -> Config msg

Adds custom header content.

withNavigationLabel : String -> Config msg -> Config msg

Adds an accessible label to sidebar navigation.

withRail : msg -> Config msg -> Config msg

Adds a full-height rail that toggles the sidebar.

view : State -> Config msg -> Html msg

Renders a configured sidebar.

newGroup : String -> Group msg

Creates an empty labeled group.

addGroup : Group msg -> Config msg -> Config msg

Adds a configured group to the sidebar.

newItem : String -> msg -> Item msg

Creates a sidebar item.

addConfiguredItem : Item msg -> Group msg -> Group msg

Adds a configured item to a sidebar group.

addItem : Bool -> msg -> String -> Group msg -> Group msg

Adds a text-only interactive item to a group.

withItemActive : Bool -> Item msg -> Item msg

Marks a sidebar item as active.

withItemIcon : Html msg -> Item msg -> Item msg

Adds an icon to a sidebar item.

newMenuButton : List (Html msg) -> MenuButton msg

Creates a sidebar menu button with arbitrary content.

Marks a sidebar menu button as active.

withMenuButtonAttributes : List (Attribute msg) -> MenuButton msg -> MenuButton msg

Adds attributes to a sidebar menu button.

Sets a sidebar menu button's size.

withMenuButtonTooltip : String -> String -> MenuButton msg -> MenuButton msg

Adds a tooltip shown while the sidebar is collapsed.

Sets a sidebar menu button's appearance.

trigger : msg -> List (Attribute msg) -> Html msg

Renders a button that toggles the sidebar.

viewMenuButton : MenuButton msg -> Html msg

Renders a sidebar menu button.

isExpanded : State -> Bool

Returns whether the desktop sidebar is expanded.

Returns the other desktop sidebar state.