Progress bar, displays progress within a range.
Props
| Name | Type | Default | Description |
|---|---|---|---|
range | {number(), number()} | required | [min, max] as a two-element list. |
value | number() | required | Current progress value. |
width | :fill | :shrink | {:fill_portion, pos_integer()} | number() | nil | Bar width. Default: fill. |
height | :fill | :shrink | {:fill_portion, pos_integer()} | number() | nil | Bar height. Default: shrink. |
| style | :default \| :primary \| :secondary \| :success \| :danger \| :warning \| :dark \| :weak \| :rounded_box \| term() | nil | Named preset or custom StyleMap. |
| vertical | boolean() | nil | When true, renders vertically. |
| label | String.t() \| atom() | nil | Accessible label for the progress bar. |
| event_rate | integer() | nil | Max events per second for coalescable events. |
| a11y | %Plushie.Type.A11y{} \| map() \| keyword() | %{role: :progress_indicator} | Accessibility annotations. |
Constructor
ProgressBar.new(id, range, value)
ProgressBar.new(id, range, value, opts)
Summary
Functions
Accessibility annotations.
Converts this widget struct to a ui_node() map.
Max events per second for coalescable events.
Bar height. Default: shrink.
Accessible label for the progress bar.
Creates a new widget struct with the given positional args and keyword options.
Creates a :progress_bar widget.
[min, max] as a two-element list.
Named preset or custom StyleMap.
Current progress value.
When true, renders vertically.
Bar width. Default: fill.
Applies keyword options to an existing widget struct.
Types
@type option() :: ((((({:width, :fill | :shrink | {:fill_portion, pos_integer()} | number()} | {:height, :fill | :shrink | {:fill_portion, pos_integer()} | number()}) | {:style, :default | :primary | :secondary | :success | :danger | :warning | :dark | :weak | :rounded_box | term()}) | {:vertical, boolean()}) | {:label, String.t() | atom()}) | {:event_rate, integer()}) | {:a11y, %Plushie.Type.A11y{ active_descendant: term(), busy: term(), described_by: term(), description: term(), disabled: term(), error_message: term(), expanded: term(), has_popup: term(), hidden: term(), invalid: term(), label: term(), label_from: term(), labelled_by: term(), level: term(), live: term(), mnemonic: term(), modal: term(), orientation: term(), position_in_set: term(), radio_group: term(), read_only: term(), required: term(), role: term(), selected: term(), size_of_set: term(), toggled: term(), value: term() } | map() | keyword()}
@type t() :: %Plushie.Widget.ProgressBar{ a11y: (%Plushie.Type.A11y{ active_descendant: term(), busy: term(), described_by: term(), description: term(), disabled: term(), error_message: term(), expanded: term(), has_popup: term(), hidden: term(), invalid: term(), label: term(), label_from: term(), labelled_by: term(), level: term(), live: term(), mnemonic: term(), modal: term(), orientation: term(), position_in_set: term(), radio_group: term(), read_only: term(), required: term(), role: term(), selected: term(), size_of_set: term(), toggled: term(), value: term() } | map() | keyword()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, event_rate: integer() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, height: (:fill | :shrink | {:fill_portion, pos_integer()} | number()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, id: String.t(), label: (String.t() | atom()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, range: {number(), number()} | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, style: (:default | :primary | :secondary | :success | :danger | :warning | :dark | :weak | :rounded_box | term()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, value: number() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, vertical: boolean() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, width: (:fill | :shrink | {:fill_portion, pos_integer()} | number()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil }
Functions
@spec a11y( widget :: t(), value :: (%Plushie.Type.A11y{ active_descendant: term(), busy: term(), described_by: term(), description: term(), disabled: term(), error_message: term(), expanded: term(), has_popup: term(), hidden: term(), invalid: term(), label: term(), label_from: term(), labelled_by: term(), level: term(), live: term(), mnemonic: term(), modal: term(), orientation: term(), position_in_set: term(), radio_group: term(), read_only: term(), required: term(), role: term(), selected: term(), size_of_set: term(), toggled: term(), value: term() } | map() | keyword()) | nil ) :: t()
Accessibility annotations.
Accepts %Plushie.Type.A11y{} | map() | keyword().
@spec build(widget :: t()) :: Plushie.Widget.ui_node()
Converts this widget struct to a ui_node() map.
Max events per second for coalescable events.
Accepts integer().
@spec height( widget :: t(), value :: (:fill | :shrink | {:fill_portion, pos_integer()} | number()) | nil ) :: t()
Bar height. Default: shrink.
Accepts :fill | :shrink | {:fill_portion, pos_integer()} | number().
Accessible label for the progress bar.
Accepts String.t() | atom().
Creates a new widget struct with the given positional args and keyword options.
Arguments
id- unique widget identifierrange-[min, max]as a two-element list.value- Current progress value.opts- keyword list of optional props
Creates a :progress_bar widget.
Shorthand for new/2. Import this macro to use the widget name
directly in view functions:
import Plushie.Widget.ProgressBar, only: [progress_bar: 2]
progress_bar("my-id", prop: value)
[min, max] as a two-element list.
Accepts {number(), number()}.
@spec style( widget :: t(), value :: (:default | :primary | :secondary | :success | :danger | :warning | :dark | :weak | :rounded_box | term()) | nil ) :: t()
Named preset or custom StyleMap.
Accepts :default | :primary | :secondary | :success | :danger | :warning | :dark | :weak | :rounded_box | term().
Current progress value.
Accepts number().
When true, renders vertically.
Accepts boolean().
@spec width( widget :: t(), value :: (:fill | :shrink | {:fill_portion, pos_integer()} | number()) | nil ) :: t()
Bar width. Default: fill.
Accepts :fill | :shrink | {:fill_portion, pos_integer()} | number().
Applies keyword options to an existing widget struct.