Packages
mishka_chelekom
0.0.9-beta.2
0.0.10-alpha.5
0.0.10-alpha.4
0.0.10-alpha.3
0.0.10-alpha.2
0.0.10-alpha.1
0.0.9
0.0.9-rc.2
0.0.9-rc.1
0.0.9-beta.5
0.0.9-beta.4
0.0.9-beta.3
0.0.9-beta.2
0.0.9-beta.1
0.0.9-alpha.20
0.0.9-alpha.18
0.0.9-alpha.17
0.0.9-alpha.16
0.0.9-alpha.15
0.0.9-alpha.14
0.0.9-alpha.13
0.0.9-alpha.12
0.0.9-alpha.11
0.0.9-alpha.10
0.0.9-alpha.9
0.0.9-alpha.8
0.0.9-alpha.7
0.0.9-alpha.6
0.0.9-alpha.5
0.0.9-alpha.4
0.0.9-alpha.3
0.0.9-alpha.2
0.0.9-alpha.1
0.0.8
0.0.8-rc.2
0.0.8-rc.1
0.0.8-beta.5
0.0.8-beta.4
0.0.8-beta.3
0.0.8-beta.2
0.0.8-beta.1
0.0.8-alpha.4
0.0.8-alpha.3
0.0.8-alpha.2
0.0.8-alpha.1
0.0.7
0.0.6
0.0.6-alpha.2
0.0.6-alpha.1
0.0.5
0.0.5-beta.2
0.0.5-beta.1
0.0.5-alpha.12
0.0.5-alpha.11
0.0.5-alpha.10
0.0.5-alpha.9
0.0.5-alpha.8
0.0.5-alpha.7
0.0.5-alpha.6
0.0.5-alpha.5
0.0.5-alpha.4
0.0.5-alpha.3
0.0.5-alpha.2
0.0.5-alpha.1
0.0.4
0.0.4-beta.3
0.0.4-beta.2
0.0.4-beta.1
0.0.4-alpha.9
0.0.4-alpha.8
0.0.4-alpha.7
0.0.4-alpha.6
0.0.4-alpha.5
0.0.4-alpha.4
0.0.4-alpha.3
0.0.4-alpha.2
0.0.4-alpha.1
0.0.3
0.0.3-alpha.3
0.0.3-alpha.2
0.0.3-alpha.1
0.0.2
0.0.2-rc.2
0.0.2-rc.1
0.0.2-beta.4
0.0.2-beta.3
0.0.2-beta.2
0.0.2-beta.1
0.0.2-alpha.3
0.0.2-alpha.2
0.0.2-alpha.1
0.0.1
Mishka Chelekom is a fully featured components and UI kit library for Phoenix & Phoenix LiveView
Current section
Files
Jump to
Current section
Files
usage-rules/components/color_field.md
# Color Field Component
Customizable color picker input component for Phoenix LiveView forms.
**Documentation**: https://mishka.tools/chelekom/docs/forms/color-field
> **For LLM Agents**: If you need more details, examples, or edge cases not covered here, fetch the full documentation from the URL above.
## Generate
```bash
# Generate with all options
mix mishka.ui.gen.component color_field
# Generate with specific options
mix mishka.ui.gen.component color_field --color primary,natural --size small,medium
# Generate with custom module name
mix mishka.ui.gen.component color_field --module MyAppWeb.Components.CustomColorField
```
## Dependencies
| Type | Components |
|------|------------|
| **Necessary** | `icon` |
| **Optional** | None |
| **JavaScript** | None |
## Attributes
| Attribute | Type | Default | Description |
|-----------|------|---------|-------------|
| `id` | `:string` | `nil` | Unique identifier |
| `name` | `:string` | `nil` | Input field name |
| `value` | `:string` | `nil` | Color value (hex) |
| `color` | `:string` | `"base"` | Color theme |
| `size` | `:string` | `"medium"` | Input size |
| `rounded` | `:string` | `"small"` | Border radius |
| `border` | `:string` | `"extra_small"` | Border width |
| `space` | `:string` | `"medium"` | Space between elements |
| `label` | `:string` | `nil` | Label text |
| `description` | `:string` | `nil` | Description text |
| `error_icon` | `:string` | `nil` | Error icon name |
| `errors` | `:list` | `[]` | Error messages |
| `class` | `:any` | `nil` | Custom CSS class |
## Slots
### `start_section` Slot
Content before the color input.
### `end_section` Slot
Content after the color input.
## Available Options
### Colors
`base`, `white`, `primary`, `secondary`, `dark`, `success`, `warning`, `danger`, `info`, `silver`, `misc`, `dawn`
### Sizes
`extra_small`, `small`, `medium`, `large`, `extra_large`
### Rounded
`extra_small`, `small`, `medium`, `large`, `extra_large`
## Usage Examples
### Basic Color Field
```heex
<.color_field name="color" value="#ff5733" label="Select Color" />
```
### With Form Integration
```heex
<.color_field
field={@form[:brand_color]}
label="Brand Color"
description="Choose your brand's primary color"
/>
```
### Different Sizes
```heex
<.color_field name="c1" size="small" label="Small" />
<.color_field name="c2" size="medium" label="Medium" />
<.color_field name="c3" size="large" label="Large" />
```
### Different Colors
```heex
<.color_field name="c1" color="primary" label="Primary" />
<.color_field name="c2" color="success" label="Success" />
<.color_field name="c3" color="danger" label="Danger" />
```
### With Description
```heex
<.color_field
name="background"
value="#ffffff"
label="Background Color"
description="This color will be used for the page background"
/>
```
### With Sections
```heex
<.color_field name="theme_color" label="Theme Color">
<:start_section>
<.icon name="hero-swatch" class="size-5" />
</:start_section>
</.color_field>
```
## Common Patterns
### Theme Customizer
```heex
<div class="space-y-4">
<.color_field
field={@form[:primary_color]}
value="#3b82f6"
label="Primary Color"
description="Main brand color"
/>
<.color_field
field={@form[:secondary_color]}
value="#64748b"
label="Secondary Color"
description="Supporting color"
/>
<.color_field
field={@form[:accent_color]}
value="#f59e0b"
label="Accent Color"
description="Highlight color"
/>
</div>
```