Skip to main content

Module color_edit

Module color_edit 

Source
Expand description

ColorEdit — compact field-style color picker trigger that opens a popover containing a ColorPicker.

Direct analog of DateEdit. The trigger is a Button with a reactive ColorSwatch in its leading slot, the current hex as the label, and an optional chevron in its trailing slot. Click, Enter, Space, or Alt+Down opens the popover; Escape or click-outside closes it. The inner picker writes through the same bound Signal<Color>, so external observers see live updates as the user drags within the popover (no commit step).

Built on PopoverButton: the overlay wiring (dormant content + show / dismiss + AT has_popup + expanded) lives there. This file is just the ColorEdit-specific assembly — picker config pass-through, the reactive trigger, and the nullable-binding bridge.

§Accessibility

The trigger declares Role::Button (via Button), HasPopup::Dialog (via PopoverButton), and tracks the popover open state through set_expanded. The label binds reactively to the hex value so AT name updates as the picker mutates the bound color.

§Example

use teksilo_core::signal::Signal;
use teksilo_tokens::Color;

let color = ctx.signal(Color::new(0.21, 0.52, 0.89, 1.0));
let _edit = ColorEdit::new(color)
    .alpha_enabled(true)
    .show_chevron(true);

Structs§

ColorEdit
Compact color cell that opens a full ColorPicker in a popover when activated.