Scrollable container -- wraps child content in a scrollable viewport.
Props
width(length) -- width of the scrollable area. Default: shrink. SeePlushie.Type.Length.height(length) -- height of the scrollable area. Default: shrink.direction(atom) -- scroll direction::vertical(default),:horizontal, or:both. SeePlushie.Type.Direction. Setting:bothenables bidirectional scrolling, but per-axis scrollbar customization (independent widths, margins per axis) is not yet supported.spacing(number) -- spacing between scrollbar and content.scrollbar_width(number) -- width of the scrollbar track in pixels.scrollbar_margin(number) -- margin around the scrollbar in pixels.scroller_width(number) -- width of the scroller handle in pixels.scrollbar_color(hex color) -- color for the scrollbar track background.scroller_color(hex color) -- color for the scroller thumb.id(string) -- widget ID for programmatic scroll control viaPlushie.Command.anchor(atom) -- scroll anchor::start(default) or:end/:bottom/:right. SeePlushie.Type.Anchor.on_scroll(boolean) -- whentrue, emits%WidgetEvent{type: :scroll, id: id, data: viewport}events on scroll. The viewport map containsabsolute_x,absolute_y,relative_x,relative_y,bounds(as{width, height}), andcontent_bounds(as{width, height}).auto_scroll(boolean) -- whentrue, automatically scrolls to show new content.a11y(map) -- accessibility overrides. SeePlushie.Type.A11y.
Summary
Functions
Sets accessibility annotations.
Sets the scroll anchor.
Enables automatic scrolling to show new content.
Converts this scrollable struct to a ui_node() map via the Plushie.Widget protocol.
Sets the scroll direction.
Appends multiple children to the scrollable.
Sets the scrollable height.
Creates a new scrollable struct with optional keyword opts.
Enables scroll position change events.
Appends a child to the scrollable.
Sets the scrollbar track color.
Sets the scrollbar margin in pixels.
Sets the scrollbar track width in pixels.
Sets the scroller handle color.
Sets the scroller handle width in pixels.
Sets the spacing between scrollbar and content.
Sets the scrollable width.
Applies keyword options to an existing scrollable struct.
Types
@type option() :: {:width, Plushie.Type.Length.t()} | {:height, Plushie.Type.Length.t()} | {:direction, Plushie.Type.Direction.t()} | {:spacing, number()} | {:scrollbar_width, number()} | {:scrollbar_margin, number()} | {:scroller_width, number()} | {:anchor, Plushie.Type.Anchor.t()} | {:on_scroll, boolean()} | {:auto_scroll, boolean()} | {:scrollbar_color, Plushie.Type.Color.input()} | {:scroller_color, Plushie.Type.Color.input()} | {:a11y, Plushie.Type.A11y.t() | map() | keyword()}
@type t() :: %Plushie.Widget.Scrollable{ a11y: Plushie.Type.A11y.t() | nil, anchor: Plushie.Type.Anchor.t() | nil, auto_scroll: boolean() | nil, children: [Plushie.Widget.child()], direction: Plushie.Type.Direction.t() | nil, height: Plushie.Type.Length.t() | nil, id: String.t(), on_scroll: boolean() | nil, scrollbar_color: Plushie.Type.Color.t() | nil, scrollbar_margin: number() | nil, scrollbar_width: number() | nil, scroller_color: Plushie.Type.Color.t() | nil, scroller_width: number() | nil, spacing: number() | nil, width: Plushie.Type.Length.t() | nil }
Functions
@spec a11y(scrollable :: t(), a11y :: Plushie.Type.A11y.t() | map() | keyword()) :: t()
Sets accessibility annotations.
@spec anchor(scrollable :: t(), anchor :: Plushie.Type.Anchor.t()) :: t()
Sets the scroll anchor.
Enables automatic scrolling to show new content.
@spec build(scrollable :: t()) :: Plushie.Widget.ui_node()
Converts this scrollable struct to a ui_node() map via the Plushie.Widget protocol.
@spec direction(scrollable :: t(), direction :: Plushie.Type.Direction.t()) :: t()
Sets the scroll direction.
@spec extend( scrollable :: t(), children :: [Plushie.Widget.child()] ) :: t()
Appends multiple children to the scrollable.
@spec height(scrollable :: t(), height :: Plushie.Type.Length.t()) :: t()
Sets the scrollable height.
Creates a new scrollable struct with optional keyword opts.
Enables scroll position change events.
@spec push(scrollable :: t(), child :: Plushie.Widget.child()) :: t()
Appends a child to the scrollable.
@spec scrollbar_color( scrollable :: t(), scrollbar_color :: Plushie.Type.Color.input() ) :: t()
Sets the scrollbar track color.
Sets the scrollbar margin in pixels.
Sets the scrollbar track width in pixels.
@spec scroller_color(scrollable :: t(), scroller_color :: Plushie.Type.Color.input()) :: t()
Sets the scroller handle color.
Sets the scroller handle width in pixels.
Sets the spacing between scrollbar and content.
@spec width(scrollable :: t(), width :: Plushie.Type.Length.t()) :: t()
Sets the scrollable width.
Applies keyword options to an existing scrollable struct.