Raxol.UI.Components.Base (Raxol v0.4.0)
View SourceProvides base functionality and utilities for Raxol components.
This module contains shared functionality used across different components, including common validation, styling, and event handling patterns.
Summary
Functions
Creates a base style for components with common properties.
Handles common events like focus, blur, and keyboard navigation.
Validates component props against a schema.
Types
@type state() :: map()
Functions
Creates a base style for components with common properties.
Handles common events like focus, blur, and keyboard navigation.
Should be called from a component's handle_event callback.
Validates component props against a schema.
Example
def validate_props(props) do
Base.validate_props(props, %{
required: [:label],
optional: [:style, :disabled],
types: %{
label: :string,
style: {:one_of, [:primary, :secondary, :danger]},
disabled: :boolean
}
})
end