Theme management for Cinder table components.
Provides default themes and utilities for merging custom theme configurations.
Basic Usage
# Using built-in themes
theme = Cinder.Theme.merge("modern")
# Using application configuration for default theme
# config/config.exs
config :cinder, default_theme: "modern"Custom Themes
defmodule MyApp.CustomTheme do
use Cinder.Theme
# Table
set :container_class, "my-custom-table-container"
set :row_class, "my-custom-row hover:bg-blue-50"
# Filters
set :filter_container_class, "my-filter-container"
end
# Use in config
config :cinder, default_theme: MyApp.CustomTheme
# Or use directly
theme = Cinder.Theme.merge(MyApp.CustomTheme)Configuration
You can set a default theme for all Cinder tables in your application configuration:
# config/config.exs
config :cinder, default_theme: "modern"
# Or use a custom theme module
config :cinder, default_theme: MyApp.CustomThemeIndividual tables can still override the configured default:
<Cinder.collection theme="dark" ...>
<!-- This table uses "dark" theme, ignoring the configured default -->
</Cinder.collection>
Summary
Functions
Gets the complete default theme.
Returns the default theme configuration.
Gets the configured default theme from application configuration.
Merges a theme configuration with the default theme.
Returns a list of available theme presets.
Returns the given theme or the default theme if nil.
Validates that a theme property key is valid.
Validates a theme configuration.
Types
Functions
Gets the complete default theme.
Returns the default theme configuration.
Gets the configured default theme from application configuration.
Returns the theme configured via config :cinder, default_theme: ...
or falls back to "default" if no configuration is set.
Examples
# With configuration
Application.put_env(:cinder, :default_theme, "modern")
Cinder.Theme.get_default_theme()
#=> returns modern theme configuration
# Without configuration
Cinder.Theme.get_default_theme()
#=> returns "default" theme configuration
Merges a theme configuration with the default theme.
Examples
iex> Cinder.Theme.merge("modern")
%{container_class: "bg-white shadow-lg rounded-xl border border-gray-100 overflow-hidden", ...}
iex> Cinder.Theme.merge(MyApp.CustomTheme)
%{container_class: "custom-container", ...}
Returns a list of available theme presets.
Returns the given theme or the default theme if nil.
Used internally by the theme DSL to avoid dialyzer warnings when extending themes.
Validates that a theme property key is valid.
Validates a theme configuration.
Returns :ok if the theme is valid, or {:error, reason} if invalid.