mbr/elm-chadcn/1.0.0

ChadCn.Tabs

Provides tabs.

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

type Config msg

Describes a complete tabs control.

type Model

Holds tabs interaction state.

type Msg

Describes messages handled by tabs.

= Horizontal
| Vertical

Controls the direction in which tabs are arranged.

type Tab msg

Describes one tab and its panel.

type Variant
= Default
| Line

Controls the visual treatment of a tab list.

init : String -> String -> Model

Creates tabs state with a stable DOM identifier and selected value.

new : (Msg -> msg) -> (String -> msg) -> Config msg

Creates an empty horizontal tabs configuration.

withAttributes : List (Attribute msg) -> Config msg -> Config msg

Adds native attributes to the tabs root.

withListAttributes : List (Attribute msg) -> Config msg -> Config msg

Adds native attributes to the tab list.

Sets the tab list orientation.

Sets the tab list visual variant.

newTab : String -> List (Html msg) -> Tab msg

Creates an enabled tab with no panel content.

addTab : Tab msg -> Config msg -> Config msg

Appends one tab to the control.

withPanel : List (Html msg) -> Tab msg -> Tab msg

Sets the content rendered by a tab panel.

withPanelAttributes : List (Attribute msg) -> Tab msg -> Tab msg

Adds native attributes to a tab panel.

withTabAttributes : List (Attribute msg) -> Tab msg -> Tab msg

Adds native attributes to a tab trigger.

withTabDisabled : Bool -> Tab msg -> Tab msg

Sets whether a tab can be selected.

selected : Model -> String

Returns the selected tab value.

setSelected : String -> Model -> Model

Replaces the selected value without emitting a change callback.

update : Config msg -> Msg -> Model -> ( Model, Cmd msg )

Applies an internal tabs event.

view : Model -> Config msg -> Html msg

Renders tabs, their trigger list, and their panels.