QR Code, renders a QR code from a data string.
Props
| Name | Type | Default | Description |
|---|---|---|---|
data | String.t() | atom() | required | Data to encode in the QR code. Required. |
cell_size | number() | nil | Size of each QR module in pixels. Default: 4.0. |
total_size | number() | nil | Total size of the QR code in pixels. Derives cell_size from this. |
cell_color | String.t() | nil | Color of dark modules. Default: black. |
background | String.t() | nil | Color of light modules. Default: white. |
error_correction | :low | :medium | :quartile | :high | nil | Error correction level: :low, :medium, :quartile, :high. |
alt | String.t() | atom() | nil | Accessible label for the QR code. |
description | String.t() | atom() | nil | Extended accessible description. |
event_rate | integer() | nil | Max events per second for coalescable events. |
a11y | %Plushie.Type.A11y{} | map() | keyword() | %{role: :image} | Accessibility annotations. |
Constructor
QrCode.new(id, data)
QrCode.new(id, data, opts)
Summary
Functions
Accessibility annotations.
Accessible label for the QR code.
Color of light modules. Default: white.
Converts this widget struct to a ui_node() map.
Color of dark modules. Default: black.
Size of each QR module in pixels. Default: 4.0.
Data to encode in the QR code. Required.
Extended accessible description.
Error correction level: :low, :medium, :quartile, :high.
Max events per second for coalescable events.
Creates a new widget struct with the given positional args and keyword options.
Creates a :qr_code widget.
Total size of the QR code in pixels. Derives cell_size from this.
Applies keyword options to an existing widget struct.
Types
@type option() :: ((((((({:cell_size, number()} | {:total_size, number()}) | {:cell_color, atom() | String.t() | map()}) | {:background, atom() | String.t() | map()}) | {:error_correction, :low | :medium | :quartile | :high}) | {:alt, String.t() | atom()}) | {:description, 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.QrCode{ 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, alt: (String.t() | atom()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, background: String.t() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, cell_color: String.t() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, cell_size: number() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, data: (String.t() | atom()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, description: (String.t() | atom()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, error_correction: (:low | :medium | :quartile | :high) | 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, id: String.t(), total_size: 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().
Accessible label for the QR code.
Accepts String.t() | atom().
Color of light modules. Default: white.
Accepts String.t().
@spec build(widget :: t()) :: Plushie.Widget.ui_node()
Converts this widget struct to a ui_node() map.
Color of dark modules. Default: black.
Accepts String.t().
Size of each QR module in pixels. Default: 4.0.
Accepts number().
Data to encode in the QR code. Required.
Accepts String.t() | atom().
Extended accessible description.
Accepts String.t() | atom().
Error correction level: :low, :medium, :quartile, :high.
Accepts :low | :medium | :quartile | :high.
Max events per second for coalescable events.
Accepts integer().
Creates a new widget struct with the given positional args and keyword options.
Arguments
id- unique widget identifierdata- Data to encode in the QR code. Required.opts- keyword list of optional props
Creates a :qr_code widget.
Shorthand for new/2. Import this macro to use the widget name
directly in view functions:
import Plushie.Widget.QrCode, only: [qr_code: 2]
qr_code("my-id", prop: value)
Total size of the QR code in pixels. Derives cell_size from this.
Accepts number().
Applies keyword options to an existing widget struct.