Filament.Component behaviour (filament v0.2.1)

Copy Markdown

Behaviour and macro for defining Filament components.

Components are modules that implement the render/1 callback and can be composed together to build UIs. The defcomponent macro provides convenient syntax for prop declarations and validation.

Summary

Callbacks

Marker function to identify Filament components

Returns component prop metadata

Validates props map at runtime

Types

props()

@type props() :: map()

rendered()

@type rendered() :: Phoenix.LiveView.Rendered.t()

Callbacks

__filament_component__?()

@callback __filament_component__?() :: boolean()

Marker function to identify Filament components

__props__()

(optional)
@callback __props__() :: keyword()

Returns component prop metadata

__validate_props__!(props)

(optional)
@callback __validate_props__!(props()) :: :ok | no_return()

Validates props map at runtime

render(props)

@callback render(props()) :: rendered()