DevactionUI.Progress (devaction_ui v0.1.0)

Copy Markdown View Source

A progress bar (role="progressbar") with a value from 0 to 100 and the tone it fills with: ink by default, amber for what the AI did, green when it is done. :segmented shows the same value in segments pieces (the steps of a job), :thin is the 2 px line of the work in the background, and indeterminate is for what has no end in sight: it shimmers (still, under reduced motion) and gives no value.

Summary

Functions

Whether piece index of segments is filled at value percent.

Functions

filled?(index, segments, value)

@spec filled?(pos_integer(), pos_integer(), 0..100) :: boolean()

Whether piece index of segments is filled at value percent.

progress(assigns)

Attributes

  • value (:integer) - 0 to 100; ignored when indeterminate. Defaults to 0.
  • label (:string) (required) - what is being measured, for assistive technology.
  • tone (:atom) - Defaults to :neutral. Must be one of :neutral, :warn, :ok, :risk, or :info.
  • variant (:atom) - Defaults to :bar. Must be one of :bar, :segmented, or :thin.
  • segments (:integer) - how many pieces the segmented one has. Defaults to 4.
  • indeterminate (:boolean) - Defaults to false.
  • show_value (:boolean) - draws the label on the left and the value in mono on the right, above the bar. Defaults to false.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.