mbr/elm-chadcn/1.0.0

ChadCn.Extra.ResponsiveTabs

Provides a responsive view selector composed from ChadCn.Tabs and ChadCn.Select.

This composition follows the responsive view selector used by shadcn blocks but is not an upstream shadcn primitive. It renders a select in narrow containers and tabs in wide containers while keeping both controls synchronized.

type Config msg

Describes a responsive tabs control.

type Model

Holds both responsive control models.

type Msg

Describes messages handled by responsive tabs.

type Option msg

Describes one value available in both responsive representations.

init : String -> String -> Model

Creates synchronized tabs and select state.

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

Creates an empty responsive tabs configuration.

addOption : Option msg -> Config msg -> Config msg

Appends one option.

newOption : String -> String -> Option msg

Creates an enabled option with matching text in both representations.

withOptionDisabled : Bool -> Option msg -> Option msg

Sets whether an option can be selected.

withOptions : List (Option msg) -> Config msg -> Config msg

Sets all available options.

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

Adds native attributes to the responsive control wrapper.

withSelectContent : List (Html msg) -> Option msg -> Option msg

Replaces an option's narrow select content.

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

Adds native attributes to the narrow select trigger.

withTabContent : List (Html msg) -> Option msg -> Option msg

Replaces an option's wide tab content.

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

Adds native attributes to the wide tabs root.

Sets the visual tabs variant.

isOpen : Model -> Bool

Returns whether the narrow select popup is open.

selected : Model -> String

Returns the selected value.

setSelected : String -> Model -> Model

Replaces the selected value without emitting a change callback.

subscriptions : Config msg -> Model -> Sub msg

Subscribes to interactions owned by the narrow select.

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

Applies a child control event and synchronizes completed value changes.

view : Model -> Config msg -> Html msg

Renders a select in narrow containers and tabs in wide containers.