QR Code -- renders a QR code from a data string.
Uses the iced canvas to draw a grid of cells representing the encoded data.
Props
data(string) -- the data to encode in the QR code. Required.cell_size(number) -- size of each QR module in pixels. Default: 4.0.cell_color(color) -- color of dark modules. Default: black.background_color(color) -- color of light modules. Default: white.error_correction(atom) -- error correction level. One of:low,:medium(default),:quartile,:high.a11y(map) -- accessibility overrides. SeeToddy.Iced.A11y.
Summary
Functions
Sets accessibility annotations.
Sets the background color (light modules).
Converts this QR code struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets the color of dark modules.
Sets the cell size (pixels per QR module).
Sets the error correction level.
Creates a new QR code struct with the given data string and optional keyword opts.
Applies keyword options to an existing QR code struct.
Types
@type error_correction() :: :high | :quartile | :medium | :low
@type option() :: {:cell_size, number()} | {:cell_color, Toddy.Iced.Color.input()} | {:background_color, Toddy.Iced.Color.input()} | {:error_correction, error_correction()} | {:a11y, Toddy.Iced.A11y.t()}
@type t() :: %Toddy.Iced.Widget.QrCode{ a11y: Toddy.Iced.A11y.t() | nil, background_color: Toddy.Iced.Color.t() | nil, cell_color: Toddy.Iced.Color.t() | nil, cell_size: number() | nil, data: String.t(), error_correction: error_correction() | nil, id: String.t() }
Functions
@spec a11y(qr_code :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
Sets accessibility annotations.
@spec background_color(qr_code :: t(), background_color :: Toddy.Iced.Color.input()) :: t()
Sets the background color (light modules).
@spec build(qr_code :: t()) :: Toddy.Iced.ui_node()
Converts this QR code struct to a ui_node() map via the Toddy.Iced.Widget protocol.
@spec cell_color(qr_code :: t(), cell_color :: Toddy.Iced.Color.input()) :: t()
Sets the color of dark modules.
Sets the cell size (pixels per QR module).
@spec error_correction(qr_code :: t(), error_correction :: error_correction()) :: t()
Sets the error correction level.
Creates a new QR code struct with the given data string and optional keyword opts.
Applies keyword options to an existing QR code struct.