Raxol.Core.Renderer.View.Components (Raxol v2.0.1)
View SourceComponent creation functions for the View module. Extracted from the main View module to improve maintainability.
Summary
Functions
Creates a simple box element with the given options.
Creates a button element.
Creates a checkbox element.
Creates a shadow effect for a view.
Creates a text input element.
Functions
Creates a simple box element with the given options.
Creates a button element.
Options
:id- Unique identifier for the button:on_click- Event handler for click events:aria_label- Accessibility label:aria_description- Accessibility description:style- Style options for the button
Examples
Components.button("Click Me", on_click: {:button_clicked})
Components.button("Submit", id: "submit_btn", aria_label: "Submit form")
Creates a checkbox element.
Options
:checked- Whether the checkbox is checked (default: false):on_toggle- Event handler for toggle events:aria_label- Accessibility label:aria_description- Accessibility description:style- Style options for the checkbox
Examples
Components.checkbox("Enable Feature", checked: true)
Components.checkbox("Accept Terms", on_toggle: {:terms_toggled})
Creates a shadow effect for a view.
Options
:offset- Shadow offset as a string or tuple {x, y}:blur- Shadow blur radius:color- Shadow color:opacity- Shadow opacity (0.0 to 1.0)
Examples
Components.shadow(offset: "2px 2px", blur: 4, color: :black)
Components.shadow(offset: {1, 1}, color: :gray, opacity: 0.5)
Creates a text input element.
Options
:value- Current value of the input (default: ""):placeholder- Placeholder text:on_change- Event handler for change events:aria_label- Accessibility label:aria_description- Accessibility description:style- Style options for the input
Examples
Components.text_input(placeholder: "Enter your name...")
Components.text_input(value: "John", on_change: {:name_changed})