Built-in column type registry.
Provides lookup for built-in column types by atom name. Custom column types can be used directly by passing the module.
Built-in Types
:text- Plain text (default):boolean- Boolean with checkmark/X icons:number- Numeric values:date- Date formatting:datetime- DateTime formatting:uuid- UUID with truncation:array- Array/list values:badge- Status badges with colors:link- Clickable links
Usage in DSL
columns do
column :name # Auto-detects type
column :status, type: :badge # Built-in type
column :color, type: MyApp.ColorType # Custom type
endSee MishkaGervaz.Table.Behaviours.TypeRegistry (base),
MishkaGervaz.Table.Behaviours.ColumnType, and
MishkaGervaz.Table.Entities.Column.
Summary
Functions
Check if type name is registered.
List all built-in type names.
Get the default type module.
Get module by type name.
Get module, falling back to type itself for custom modules.
Infer column type module from Ash attribute type.
Resolve column type module from explicit type or Ash attribute.
Functions
Check if type name is registered.
@spec builtin_types() :: [atom()]
List all built-in type names.
@spec default() :: module() | nil
Get the default type module.
Get module by type name.
Returns the module for built-in types, or the type itself if it's already a module (for custom types).
Get module, falling back to type itself for custom modules.
Unlike get/1 which returns nil for unknown types,
this returns the type as-is (assuming it's a custom module).
Infer column type module from Ash attribute type.
Maps Ash types to appropriate column type modules for rendering. Returns default type when attribute is nil or type is unknown.
Auto-generated from builtin type registry mappings.
Resolve column type module from explicit type or Ash attribute.
Checks in order:
- If type_module is already set (from DSL transform), use it
- If ui.type is set and is a module with
render/4, use it directly - If ui.type is set and is an atom, look up in built-in registry
- Otherwise, infer from Ash attribute type
Examples
iex> MishkaGervaz.Table.Types.Column.resolve_type(%{ui: %{type: :badge}}, %{})
MishkaGervaz.Table.Types.Column.Badge
iex> MishkaGervaz.Table.Types.Column.resolve_type(%{name: :active}, %{active: %{type: Ash.Type.Boolean}})
MishkaGervaz.Table.Types.Column.Boolean