Components — Overview
Concept
Each note in this folder is a contract: what the component takes, what state and slots it hands to the skin's renderer, which tokens a skin should use, and what accessibility it guarantees under every skin. Platform notes implement the contract. Skins draw it.
The v1 set
v0.1 ships the full component set (ADR-40): the original set (ADR-21), CamoPagedList and CamoSkeleton (ADR-29), the date and time pickers, stepper and accordion (ADR-35), every "Later" row of the Component Inventory, and the charts.
Overlays (dialogs, bottom sheets) open through the platform's navigator: Flutter showCamoDialog/showCamoBottomSheet, Compose Navigation 3 entries with Camouflage scene metadata. See Overlays.
Primitives
The building blocks every other component uses.
| Component | Milestone | What it proves |
|---|---|---|
| CamoText | M3 | typography roles, content color, rich text |
| CamoIcon | M3 | icon widgets that follow the ambient icon style |
| CamoSurface | M3 | surface levels and the skin's surface treatment |
| CamoDivider | M3 | themed separators |
Actions
Things the user presses to do something.
| Component | Milestone | What it proves |
|---|---|---|
| CamoButton | M3 | six appearances × tones, the reference component |
| CamoIconButton | M3 | icon-only actions with a required label and tooltip |
| CamoFab | M8 | the screen's primary floating action |
Inputs
Controlled inputs and forms.
| Component | Milestone | What it proves |
|---|---|---|
| CamoTextField | M5 | controlled text, filters and display formats |
| CamoCheckbox | M5 | boolean with label, rich label, error |
| CamoSwitch | M5 | on/off that applies immediately |
| CamoRadio | M5 | one choice from a visible set, roving focus |
| CamoSegmentedControl | M5 | compact single or multi selection |
| CamoSlider | M5 | continuous or stepped values |
| CamoSearchField | M5 | search conventions on the text-field engine |
| CamoSelect | M6 | a field that opens a menu or a picker sheet, async options |
| CamoForm | M5 | Flutter-style Form and FormField on both platforms, rules as objects |
| CamoDatePicker | M5 | a date or date range: a field that opens a calendar (sheet or popup), and an inline CamoCalendar (ADR-35) |
| CamoTimePicker | M5 | a time: fields, dial or wheel by theme; the device's 12/24-hour setting |
| CamoStepper | M5 | a quantity with − and +, one adjustable control |
Containers and Lists
Grouping content.
| Component | Milestone | What it proves |
|---|---|---|
| CamoCard | M6 | appearance × tone containers, optional click |
| CamoListItem | M6 | rows and sections: settings, contacts, pickers |
| CamoPagedList | M6 | API-backed lists: refresh, next page, skeletons, empty and error states, from a plain state (ADR-29) |
| CamoAccordion | M6 | expandable sections (FAQ, details), controlled |
Data Display
Compact pieces of information.
| Component | Milestone | What it proves |
|---|---|---|
| CamoChip | M7 | filter, input, action chips and status tags |
| CamoBadge | M7 | counts and dots on icons and navigation items |
| CamoAvatar | M7 | photo, initials, presence |
Feedback
Telling the user what's happening.
| Component | Milestone | What it proves |
|---|---|---|
| CamoProgress | M7 | bars and circles, determinate or indeterminate |
| CamoSnackbar | M7 | queued messages through Camouflage's messenger |
| CamoBanner | M7 | inline status messages by tone |
| CamoSkeleton | M6 | loading placeholders shaped like content (used by CamoPagedList) |
Overlays
Content above the page.
| Component | Milestone | What it proves |
|---|---|---|
| Overlays | M6 | frames and navigator integration (Flutter show, Compose Navigation 3) |
| CamoDialog | M6 | the dialog content component |
| CamoBottomSheet | M6 | the sheet content component |
| CamoMenu | M6 | anchored popups and context menus |
| CamoTooltip | M6 | hover, focus and long-press labels |
Navigation
App chrome for moving between destinations (routing stays with the app).
| Component | Milestone | What it proves |
|---|---|---|
| CamoTopBar | M6 | title, navigation and actions, scroll-aware |
| CamoTabs | M8 | tab bar for sibling views |
| CamoNavigationBar | M8 | bottom navigation, CamoNavItem, adaptive navigation |
| CamoNavigationRail | M8 | side rail for medium windows |
| CamoNavigationDrawer | M8 | permanent and modal drawers |
Reviewing a component: API or theme?
- ADR-23: a parameter goes into the component API only if every dialect can render it.
- ADR-28: a layout or proportion choice that a brand's Figma commonly changes goes into the component theme, with a per-skin default.
- ADR-30: for designs that go further (floating, hiding, expanding, reshaped components), offer the cheapest level that covers them: theme option → controlled behavior input → public building blocks → renderer override.
About the "Material mapping preview" and defaults in component notes
Each component note shows a Material mapping preview and Material defaults in its component-theme table. Material is the reference dialect because its measurements are public and complete. The v1 skin is Minimal: its defaults for every component are in one table in Minimal Skin §3.4, and that's what v1 implements.
Rules shared by every component
- Controlled. The component never owns the source of truth. Values come in (
checked,value) and changes go out (onCheckedChange,onValueChange). The only internal state is interaction (pressed/focused/hovered), which is visual. - Camouflage's own vocabulary. Components with visual variants take
appearance(Solid,Soft,Raised,Outline,Ghost,Link) andtone(Default,Error,Success,Warning,Info), independently. They never use one design system's private terms (Material'stonal, Apple'sborderedProminent). See Design Language. - The component owns behavior; the renderer owns visuals. Callbacks, the semantics role and label, the enabled gate, the minimum touch target (48dp) and focusability are set by the component, so they hold under every skin.
- Layout stays with the platform. No
CamoRoworCamoColumn. UseRow/Column/Box(Compose) orRow/Column/Stack(Flutter), withCamouflage.spacingfor gaps. - Text is a value, icons are widgets, layout is a slot. Labels, titles and messages are
Strings the renderer draws. Icons are passed as icon widgets (yourAppIcon.x()) and follow the icon style the component sets. Nested actions are Camouflage components (dialog buttons, top-bar icon buttons). Only free layout (card, surface, dialogcontent) is a slot. See ADR-12 in Decisions. - Platform extras are added at the platform level. Each platform adds its own conventional parameters (a Kotlin
modifier: Modifier, a Flutterkey) on top of the contract.
How each component note is organised
- §1 Why: what problem the component solves.
- §2 Shape: the render flow for this component, and a Material mapping preview.
- §3 API: the Contract (parameters, state, slots), Tokens used, and Accessibility.
- §4 Build steps: the build checklist, ending in Done when.
- §5 Edge cases.
Charts
Charts without a chart library, in their own package (ADR-40).
| Component | Milestone | What it proves |
|---|---|---|
| Chart Frame | M11 | the package, scales, axes, legend, tooltip, data table fallback and the style layers |
| CamoSparkline | M11 | a trend with no axes, readable as text |
| CamoLineChart | M11 | line, area and stacked area |
| CamoBarChart | M11 | vertical, horizontal, grouped and stacked bars |
| CamoPieChart | M11 | pie and donut with a center label |
Implementation
Every Kotlin component note implements its base contract from Components — Overview, and follows the same component skeleton. Learn it once here, and each component note only covers what's specific to it.
The component skeleton
@Composable
public fun CamoButton(
text: String,
onClick: () -> Unit,
modifier: Modifier = Modifier, // Compose convention: first optional param
appearance: Appearance? = null, // null → ButtonTheme.defaultAppearance
tone: Tone = Tone.Default,
enabled: Boolean = true,
loading: Boolean = false,
prefixIcon: (@Composable () -> Unit)? = null,
suffixIcon: (@Composable () -> Unit)? = null,
interactionSource: MutableInteractionSource? = null, // Compose convention: hoistable source
) {
val skin = requireSkin("CamoButton") // 1. fail fast, named
val theme = requireTheme("CamoButton")
val source = interactionSource ?: remember { MutableInteractionSource() }
val interaction = source.collectInteractionState() // 2. pressed/focused/hovered
val style = remember(skin, theme) { skin.button.defaults(theme).merge(theme.components.button) } // 3. resolve
val behavior = modifier // 4. behavior modifier
.minimumTouchTarget()
.clickable(source, indication = null, enabled = enabled, role = Role.Button, onClick = onClick)
.semantics(mergeDescendants = true) { contentDescription = text }
skin.button.Render( // 5. delegate
state = ButtonState(text, enabled, loading, appearance ?: style.defaultAppearance, tone, interaction, source),
slots = ButtonSlots(prefixIcon, suffixIcon),
theme = theme, style = style, modifier = behavior,
)
}
- Fail fast with the component's name (Provider and Scoping).
- Interaction:
collectInteractionState()(a core helper) combinescollectIsPressedAsState,collectIsFocusedAsStateandcollectIsHoveredAsStateintoInteractionState. - Resolve the component style once per skin/theme change (
rememberkeys). - The behavior modifier does clicks, the role, semantics and the touch target, with
indication = nullbecause the renderer draws the feedback. - Delegate to the renderer, which applies
behavioroutermost (Skin Contract).
Core helpers every component uses
| Helper | What it does |
|---|---|
Modifier.minimumTouchTarget(size = 48.dp) | a layout modifier that reports at least 48×48 and centers the visual content, expanding the pointer area without growing the visuals (the same technique as Material 3's minimumInteractiveComponentSize, reimplemented because core doesn't depend on material3) |
MutableInteractionSource.collectInteractionState() | InteractionState from the four collectIs…AsState flows (pressed, focused, hovered, dragged) |
rememberRovingFocus(count) | one Tab stop per group, arrow keys move (and select, for radios, segments, tabs, chip groups), RTL-aware |
Modifier.camoClickable(onClick, enabled, role) | public: clickable + the active skin's feedback + the touch target, for an app's own clickable rows. Switching or borrowing skins restyles them too. |
rememberHideOnScroll(listState) | visible = false while scrolling down, for the nav bar, top bar and FAB (ADR-30) |
ProvideContentStyle(color, iconStyle) | sets LocalCamoContentColor + LocalCamoIconStyle for slots |
Modifier.camoError(message: String?) | semantics error(message) + a polite live region when the message appears |
Components
The components follow the same 8 groups as Components — Overview. All 40 have a Kotlin note.
| Group | Note | Compose building blocks |
|---|---|---|
| Primitives | CamoText | BasicText, AnnotatedString, LinkAnnotation |
| Primitives | CamoIcon | Image + ColorFilter.tint, Compose Resources |
| Primitives | CamoSurface | Box + surface treatment |
| Primitives | CamoDivider | Box + clearAndSetSemantics |
| Actions | CamoButton | the skeleton above |
| Actions | CamoIconButton | the skeleton, icon-only |
| Actions | CamoFab | AnimatedVisibility, animateContentSize |
| Inputs | CamoTextField | state-based BasicTextField, InputTransformation, OutputTransformation |
| Inputs | CamoCheckbox | toggleable(role = Checkbox) |
| Inputs | CamoSwitch | toggleable(role = Switch), animateDpAsState |
| Inputs | CamoRadio | selectable(role = RadioButton), selectableGroup, roving focus |
| Inputs | CamoSegmentedControl | Row + weight, building blocks |
| Inputs | CamoSlider | pointerInput drag, progressBarRangeInfo + setProgress |
| Inputs | CamoSearchField | BasicTextField + ImeAction.Search |
| Inputs | CamoSelect | CamoFieldFrame + menu popup or sheet frame |
| Inputs | CamoDatePicker | kotlinx-datetime, expect locale data, 6×7 grid |
| Inputs | CamoTimePicker | LocalTime, expect 12/24-hour, three styles |
| Inputs | CamoStepper | one adjustable node, hold-to-repeat coroutine |
| Inputs | CamoForm | LocalCamoForm, FocusRequester, rememberSaveable |
| Containers and Lists | CamoCard | Box, optional clickable |
| Containers and Lists | CamoListItem | Row, section Layout with dividers |
| Containers and Lists | CamoPagedList | LazyColumn, snapshotFlow trigger, NestedScrollConnection pull |
| Containers and Lists | CamoAccordion | AnimatedVisibility, heading + state semantics |
| Data Display | CamoChip | toggleable / selectable, FlowRow / LazyRow |
| Data Display | CamoBadge | custom Layout for CamoBadgedBox |
| Data Display | CamoAvatar | initials under the app's image, FNV hash color |
| Feedback | CamoProgress | Canvas, rememberInfiniteTransition, progressSemantics |
| Feedback | CamoSnackbar | suspending CamoMessenger, live regions, anchoredDraggable |
| Feedback | CamoBanner | Row + FlowRow actions, live region |
| Feedback | CamoSkeleton | shared InfiniteTransition, drawWithCache |
| Overlays | Overlays | frames in core + camouflage-navigation3 scene strategies |
| Overlays | CamoDialog | content inside core's CamoDialogFrame |
| Overlays | CamoBottomSheet | AnchoredDraggableState, nestedScroll, IME insets |
| Overlays | CamoMenu | Popup + flip positioning, keys, CamoMenuPanel |
| Overlays | CamoTooltip | non-focusable Popup, hover/focus/long-press triggers |
| Navigation | CamoTopBar | Row, WindowInsets, heading() semantics |
| Navigation | CamoTabs | measured indicator, HorizontalPager sync |
| Navigation | CamoNavigationBar | insets, placement, hide on scroll, adaptive layout |
| Navigation | CamoNavigationRail | Column, start insets |
| Navigation | CamoNavigationDrawer | permanent panel, modal anchoredDraggable |
File layout in :camouflage-core
org/srctool/camouflage/core/
├── theme/ CamoTheme, CamoColors, …, SeedScheme, ThemeValidator
├── skin/ CamoSkin, SurfaceTreatment, InteractionFeedback, InteractionState, shared enums
├── provider/ CamouflageProvider, Camouflage, locals, reduced motion (expect)
├── util/ minimumTouchTarget, collectInteractionState, ProvideContentStyle, camoError
├── text/ CamoText, CamoSpan, TextRenderer, TextState
├── icon/ CamoIcon, IconSource, IconStyle, IconTheme, IconRenderer
├── button/ CamoButton, ButtonState/Slots/Theme/Style/Colors, ButtonRenderer
├── … one package per component
└── form/ CamoForm, CamoFormState, CamoFormField, CamoRule, CamoRules, form fields
Web (planned)
The component contracts in base/03 - Components are written as Kotlin signatures (CamoButton(text, onClick, appearance, tone, enabled, loading, prefixIcon, suffixIcon)). This note says how every kind of parameter becomes a custom element, so each web component follows the same rules and a parameter is easy to find from the contract. The spike (srctool/camouflage-web#1) tests rules 1 to 8 on the button and the dialog; the input rules (§3.5) are confirmed at W3.
1. Why
Without shared conventions each component would invent its own attributes, events and slots. Web APIs also differ from Compose and Flutter in ways that matter: values reach elements as strings (attributes) or as JS values (properties), events are DOM events, and there are no lambdas for content, only slots.
The contract stays the source of truth. This note does not rename anything: a parameter named supportingText is supporting-text as an attribute and supportingText as a property, always.
2. Shape
| Contract (Kotlin and Dart) | Web |
|---|---|
a component CamoTextField | a custom element camo-text-field, class CamoTextField, tag registered by the define entry |
a value parameter (String, Boolean, enum, number) | an attribute and a property, kept in sync |
an object, list or function parameter (inputFilter, displayFormat, items, rules) | a property only |
a widget parameter (prefixIcon, confirm) | a named slot (slot="prefix-icon") |
a single layout content: Slot | the default slot |
a callback onClick, onValueChange | a DOM event (click, input) or a camo-* custom event |
modifier (size, padding, alignment) | CSS on the host element (class, style) |
skin and theme (never parameters) | the provider (context and CSS variables) |
3. API
3.1 Names
| Thing | Rule | Example |
|---|---|---|
| Tag | camo- + the component name in kebab-case, without the Camo prefix | CamoSegmentedControl → camo-segmented-control |
| Class | the contract name | CamoSegmentedControl |
| Attribute | the parameter in kebab-case | supportingText → supporting-text |
| Property | the parameter in camelCase, same as the contract | el.supportingText |
| Enum value | lowercase kebab-case string | Appearance.Solid → appearance="solid", Tone.Error → tone="error" |
| Slot | the widget parameter in kebab-case | prefixIcon → slot="prefix-icon" |
| Event | the DOM event if one exists, else camo- + kebab-case | click, camo-dismiss |
| CSS part | named in the component note | ::part(label) |
3.2 Values: attributes and properties
- Primitive values and enums are both an attribute and a property. The property is the source of truth; attributes reflect only where the value is part of the look or the state (
appearance,tone,disabled,loading,selected,open), so styling and tests can select on them. - Absent means null. A nullable parameter (
appearance: Appearance? = null) is "not set" when the attribute is absent; the theme's default applies. Setting the property tonullremoves the attribute. - Booleans default to false. HTML booleans are present or absent, and cannot be "true by default" cleanly. A contract parameter that defaults to
trueis inverted:
| Contract | Web |
|---|---|
enabled: Boolean = true | disabled (absent = enabled) |
singleLine: Boolean = true | multiline (absent = single line) |
loading: Boolean = false | loading |
secure: Boolean = false | secure |
- Text values are attributes, not slot content. The contract says text is a value the renderer draws in its own style (
text,label,title,message,placeholder,supportingText,error), and a renderer may not inspect a slot. So<camo-button text="Save">, not<camo-button>Save</camo-button>. This also keeps server rendering simple: the renderer gets the string from an attribute, and the light DOM is not needed to render. Using the default slot as the text is an open question (§5). - Numbers are attributes parsed as numbers and properties as numbers. Dates and times are ISO strings (
2026-11-22,13:45,2026-11-22T13:45); a range is two properties,startandend. - Objects, lists and functions are properties only. Frameworks that can't pass properties declaratively set them in code (React 19, Vue, Svelte and Angular can).
3.3 Widgets and content: slots
- A widget parameter is a named slot in kebab-case:
prefixIcon→<camo-icon slot="prefix-icon">, dialogconfirmanddismiss→slot="confirm"andslot="dismiss". - A single layout content parameter (
content: Slot) is the default slot. - A skin only decides where a slot goes (the renderer places the
<slot>); it never looks at what is slotted in (the Skin Contract rule). The slot names a component exposes are part of its contract and appear in the Custom Elements Manifest. - Icons: a
camo-icontakes inline SVG as its child (<camo-icon><svg …/></camo-icon>) or anameregistered withregisterIcons({ plus: "<svg…" }). It takes its size and color from--camo-icon-sizeand--camo-content-color, set by the container.
3.4 Events and callbacks
| Contract | Web |
|---|---|
onClick | the native click event. The element handles Enter and Space, and does not fire click when disabled or loading (it stops the event in the capture phase). |
onFocusChanged | the native focus and blur events (they don't bubble; focusin and focusout do) |
onValueChange | input while editing and change on commit, both native-style; the detail-less event reads from el.value |
| Other callbacks | a CustomEvent named camo- + kebab-case, with a typed detail, bubbles: true, composed: true (so it crosses shadow roots) |
Rules: an event is fired once per user action; a cancelable event can be cancelled with preventDefault(), and the element then keeps its previous state. Event names and detail types are listed in the manifest and in the HTMLElementEventMap type (section 3.8).
3.5 Inputs, forms and controlled values
The contract's inputs are controlled (value plus onValueChange). On the web:
valueis a property and attribute (initial value). The element updatesvalueitself when the user edits, and fires a cancelablecamo-before-change(detail{ value }) first. CallingpreventDefault()on it rejects the edit, which gives the same control a controlled input has in Compose and Flutter. Then it firesinputand, on commit,change.- A framework that wants a fully controlled input sets
valuein response to the event, and nothing else is needed. - Every input is form-associated (
ElementInternals): it takesname,value,required,disabled, takes part inFormData,resetandform.checkValidity(), and reports validity withsetValidity. A text field shows itserrorattribute (the contract'serror: String?) as the error state. Confirmed in W3: anerroralso makes the input invalid to its form (customError), soform.checkValidity()andrequestSubmit()honor it; the user's next edit clears a message the form set. CamoFormand its form fields: the rules are objects, sorulesis a property, a rule or a list of rules by inputname. Form-level state is read through events (camo-submit,camo-invalid,camo-changed) andform.validandform.dirty. Confirmed in W3: every input with anameinside the form takes part, so there is no field wrapper; it works with a native<form>around it or alone.inputFilteranddisplayFormatare properties (objects with functions), never attributes.
3.6 Overlays
The base notes open overlays through the platform's navigator (showCamoDialog in Flutter, Navigation 3 entries in Compose). The web offers both forms:
<camo-dialog open title="Delete item?" message="This can't be undone.">
<camo-button slot="confirm" tone="error" text="Delete"></camo-button>
<camo-button slot="dismiss" appearance="ghost" text="Cancel"></camo-button>
</camo-dialog>
const result = await showCamoDialog<boolean>({
title: "Delete item?",
message: "This can't be undone.",
confirm: { text: "Delete", tone: "error", result: true },
dismiss: { text: "Cancel", appearance: "ghost", result: false },
});
- The dialog is a native
<dialog>element shown in the top layer; menus, popovers and tooltips use the Popover API. Focus trapping, Escape and scrim dismissal follow the overlay note. Confirmed in W4: one overlay frame (CamoModal) serves the dialog and the bottom sheet; the menu, the tooltip and the pickers use the Popover API; both forms of the dialog (declarative andshowCamoDialog) work and attach to the nearest provider. - The imperative helpers return a promise resolved with the result (or
undefinedwhen dismissed), like Flutter'sshowCamoDialog<T>. They attach to the nearest provider (or to ahostoption), so the skin and theme come from the right place. - A declarative overlay fires
camo-closewithdetail: { result }, andopenis a property and attribute. - Dismissal rules, back behavior and result types come from the base overlay note, not from this one.
3.7 Lists and collections
- A list of items is slotted children (
<camo-list-item>) when it is static, and astateproperty with arenderItemfunction when it is data-driven (CamoPagedListtakes its paging state as an object, like the contract). Virtualization, if needed, is the component's concern and invisible to callers. - A list of items is slotted children when static (
camo-list-itemin acamo-list-section) and astateproperty with arenderItemfunction when data-driven (camo-paged-list). Amended in W4: an item carriesselectedandclickableand reports a press as the nativeclick; no container event was needed, because a controlled list setsselecteditself. Rows and sections are drawn by the skin; the section draws the dividers.
3.8 TypeScript
Every component exports its class, a props interface and its events, and augments the global maps so types work everywhere:
export interface CamoButtonProps {
text: string;
appearance?: Appearance | null;
tone?: Tone;
disabled?: boolean;
loading?: boolean;
}
declare global {
interface HTMLElementTagNameMap { "camo-button": CamoButton }
}
- Enums are string-literal unions (
type Appearance = "solid" | "soft" | "raised" | "outline" | "ghost" | "link"), so attributes and properties share one type. - Framework typings (JSX for React,
GlobalComponentsfor Vue, and so on) are generated from the Custom Elements Manifest, not written by hand. - The manifest is checked against the contract: a test fails if a component is missing a parameter, an enum value or a slot the contract names.
3.9 Accessibility
- The host element carries the role and label through
ElementInternals(internals.role,internals.ariaLabel,ariaDisabled,ariaBusy), not through ids that would have to cross a shadow root. A label fromlabel, from text, or from a slotted label becomes the accessible name. - An icon-only control requires
label(the contract's required label); a missing one logs in development and fails the test. - Keyboard maps are the same as in the base notes. Focus is visible whenever it comes from the keyboard.
loadingsetsaria-busyand keeps the control focusable, as in the button contract.
4. Build steps
- W0: apply sections 3.1 to 3.4, 3.6 and 3.9 to
camo-buttonandcamo-dialog; write the manifest check for the two. - W1: the manifest-versus-contract test as a CI step; the
HTMLElementTagNameMapand framework typing generation. - W3: confirm and finish section 3.5 on the text field, checkbox, switch and the form.
- W4: confirm section 3.7 on the list and the paged list.
- Update this note with what each milestone settles, and add an ADR when a rule changes the contract.
Done when
- Every component in a milestone follows sections 3.1 to 3.4 with no exceptions beyond those listed here.
- The manifest check passes for every shipped component.
- The spike's button and dialog render the same markup under Minimal and Cupertino.
5. Edge cases
| Case | Decided behavior |
|---|---|
Text as the default slot (<camo-button>Save</camo-button>) | Open. It is the habit of most web developers, but a renderer gets a string from an attribute and server rendering has no light DOM at render time. Proposed for later: support it only when the element can read its own text before first render, with the attribute winning if both exist. |
A framework sets a boolean attribute to the string "false" | The property is the source of truth. Document that disabled="false" is still disabled (HTML semantics); frameworks should use the property or omit the attribute. |
| An attribute and its property are both set | The last write wins, and the attribute reflects the property. |
A camo-* event name that clashes with a native one | Use the native one when its meaning matches exactly; never reuse a native name with a different meaning. |
| A component needs a parameter the contract has no name for | Add it to the base contract first (ADR), then to the three platforms. |
| Server rendering | Initial state is read from attributes only. Properties that hold objects must be set again on the client after hydration (the component note says which). |
| Right-to-left | dir comes from the document or provider; slots named prefix and suffix follow the writing direction, never left and right. |
6. What the spike settled (W0, srctool/camouflage-web#5)
Applied to camo-button and camo-dialog, checked by tests/node/manifest.test.ts, which generates the Custom Elements Manifest fresh and compares it with the contract (attributes, enum values, slots, events, inverted booleans).
| Finding | Decision |
|---|---|
The contract's single content: Slot | It is the default slot (<slot name="">), not a slot named content. The skin's slots.content is "". Tested in the browser under both skins. |
title is also a global HTML attribute | The browser would show a tooltip over the whole dialog. The element reads the attribute into the property and removes it. Other components should avoid a contract name that collides with a global attribute, or do the same. |
| Properties and decorators | static properties plus declare fields, no decorators (they need build support and are not standard everywhere). Attributes reflect only where §3.2 says. |
| Where focus goes in a dialog | The slotted actions are light DOM, so native autofocus cannot see them. The dialog focuses an [autofocus] child, else dismiss, else confirm, after that button's first update. The dialog frame draws no focus ring of its own. |
| Manifest tooling | @custom-elements-manifest/analyzer does not follow a defineElement() helper, so each class carries @tagname, @slot, @fires and @attr in its JSDoc. Enum values are not in the attribute's type text (only the alias name), so the check resolves aliases from skin/types.ts. The default slot appears in the manifest with the name "". |
click when disabled or loading | Not fired (stopped in the capture phase); aria-disabled and aria-busy come from ElementInternals. Tested, axe passes. |
Answers to the open questions
- Default slot as the text: not in W0. Text stays an attribute; revisit after W1 with real usage, with the attribute winning if both exist.
- One overlay options type or two: two.
showCamoDialogtakesShowDialogOptions<T>(actions are objects with aresult), the declarative element takes attributes and slotted buttons. They share the field namestitleandmessage, and both close throughcamo-closewith{ result }.
7. What W1 settled (srctool/camouflage-web#12 and #13)
| Finding | Decision |
|---|---|
| Contract file | camouflage-contract.json (draft schema in the web repository, shared with srctool/camouflage#64): per component, its parameters (values with enum values and defaults, slots, callbacks) and its theme fields, in the base notes' names. The web mapping is derived from it by the rules of §3.1 to §3.4, in one place. A default-true boolean must be listed as inverted, or the check fails. |
| Manifest check | The manifest is generated fresh and checked against the contract for every component, including camo-provider: attributes, enum values, slots, events, inverted booleans, kebab-case. It is published as custom-elements.json in the core package. |
| Typings | Generated from the manifest and checked in CI: the tag and event maps (HTMLElementTagNameMap, HTMLElementEventMap), JSX for React 19 (@srctool/camouflage-core/react) and GlobalComponents for Vue (/vue). Compiled against a DOM, a React and a Vue consumer. |
| Theme-field gaps | actionsLayout, titleAlign, showCloseButton, stackedScrim (dialog) and defaultAppearance (button) are not CSS values. They are listed and tested as gaps; a field leaves the list when the web carries it. |
| Scenarios | One list (scenarios/scenarios.json, JSON Schema) expands over skin, mode, text scale and direction into ids like the Kotlin file names. A new component needs a scenario entry and no test code: the Storybook harness story, the Playwright runner (three browsers, 0.5% tolerance, Linux baselines from CI) and the conformance checks read it. |
| Test modes | reduced-motion, reduced-transparency and blur-off make the environment report that value, so a skin's fallback is exercised in any browser. |
| Size budget | pnpm size fails over a gzip budget set about 10% above the size; a milestone that adds components raises it in its pull request. |
| Open | The scenario list is read by the web suite only: Kotlin's Roborazzi and Dart's Alchemist have not agreed to read it. The schema is a draft until srctool/camouflage#64 and the generator accept it. |
8. What W2 settled (srctool/camouflage-web, milestone W2)
| Finding | Decision |
|---|---|
CamoText(style) | The attribute is variant (body-medium, title-large, …): style is the global HTML attribute for inline CSS. The contract file lists variant; Kotlin and Dart keep style. |
| Rich text | Markup in the default slot (<strong>, <em>, <a href>), styled by the skin, instead of a span list. Each link is a real, focusable link. |
| Icons | registerIcons({ name: pathData | { svg, viewBox, autoMirror, original } }), or an inline <svg> child. Trusted markup, drawn through unsafeSVG so it also renders on the server. No label means decorative (aria-hidden); a label means role="img". An unregistered name draws an empty box. |
| Ambient icon style | --camo-icon-size and --camo-content-color, set by every container (button, icon button, surface). The icon theme's size and color are gaps: the provider's reset is the root style. |
| Surface | level, shape, elevation, border; the skin's surface treatment paints it and clips content to the shape. It sets the content color to onSurface for its subtree. A block flag on SurfaceTreatment.decorate separates a region of content from a centered control. |
| Divider | Decorative (aria-hidden). Insets follow the reading direction; a vertical divider takes the height of its row. |
| Icon button | label is required and is the accessible name. Ghost by default; Raised falls back to Soft and Link to Ghost. The contract's non-null checked becomes toggle plus checked (an HTML boolean cannot be null); aria-pressed only when toggle. 48 px touch area around a 40 (Minimal) or 44 (Cupertino) container. |
| Tooltip | A stand-in drawn by the skin on hover and keyboard focus, hidden from assistive technology; the overlay camo-tooltip (W5) replaces it. |
| Shared drawing | textBase, iconBase, surfaceBase, dividerBase, iconButtonBase in core; a skin supplies defaults(theme) and spreads the base, so the no-literals rule still holds. |
| Robustness | An empty attribute (appearance="", what a framework binding sends for "none") means absent. |
9. What W3 settled (srctool/camouflage-web, milestone W3)
| Finding | Decision |
|---|---|
| One base | CamoControl: a form-associated element with name, required, disabled and error; value and validity through ElementInternals; FormData, reset, checkValidity and disabled <fieldset> work. Events: a cancelable camo-before-change ({ value }), then input once per edit, and change on commit. |
| The editable node | Core builds the <input> and hands it to the renderer as nodes.input; the renderer places it and draws label, helper text and error around it. They meet through fixed ids in the shadow root (input, label, supporting, error). The same node is the search field's, the stepper's and the pickers'. |
| Filters and formats | inputFilters and displayFormats are pure objects applied by applyEdit(previous, typed, cursor, …) around each edit; the cursor maps between raw and shown text. They run in Node. |
| Options are children | camo-radio in camo-radio-group, camo-segment in camo-segmented-control: they render on the server and work in plain HTML. The group owns selection, the roving tab stop and the arrows (move and select, wrap, skip disabled). Server-render checked or selected on the child to avoid a flash. |
| Rich labels | A role makes its children presentational: a link in a checkbox label is focusable but invisible to a screen reader (axe nested-interactive). Labels take <strong> and <em>; a link or control in one warns. The link goes next to the control. A gap against the Kotlin and Dart labelSpans. |
| Form | rules by input name: a rule or a list; rules are plain functions (CamoRules.required, requiredTrue, minLength, maxLength, min, max, pattern, email, matches), first failure wins. validate-mode: disabled (on submit), always, on-user-interaction, on-unfocus. camo-button type="submit" or Enter validates, then fires camo-submit (cancelable) or camo-invalid and focuses the first invalid input. setErrors takes server errors by name. |
| Dates and times | ISO strings; month, weekday names, first weekday and the day label read by a screen reader come from Intl; calendar arithmetic is on year, month and day, so no time zone. A range is start and end; it submits start/end. |
| Pickers | A field plus a native popover (popover="auto": Escape, outside click, light dismiss), a popup below the field or a sheet from the bottom (presentation, auto by window width); camo-calendar is its own element. Single dates confirm with Cancel and OK (or instant); a range has Done and Clear. Space opens on key up. |
| Skin choices | timePicker is fields in Minimal and wheel in Cupertino (each wheel one adjustable control). Cupertino has no date wheel yet. Radio is a ring in Minimal and a checkmark list in Cupertino; the switch is the iOS 51 by 31. |
| Names | value for query; step (a spacing) for steps; checked for selected; readonly is the inverted allowTyping; hour-cycle is use24Hour. |
| Gaps | Typing a date into the field (allowTyping); CamoFieldFrame as an element; the theme fields that change structure (labelPlacement, labelPosition, showCheckIcon, showStopMarks, showValueLabel, stepper layout, showOutsideDays, time picker style). |
10. What W4 settled (srctool/camouflage-web, milestone W4)
| Finding | Decision |
|---|---|
| Overlay frame | CamoModal: a native <dialog> shown with showModal() (top layer, scrim, focus trap, inert page, Escape), plus dismissal by the scrim, close(result), one camo-close, a focus target in slotted content, and an overlay that a server renders open and that becomes modal on hydration. persistent turns scrim and Escape off. |
| Popover overlays | Menu, tooltip and the pickers use popover="auto" (or manual). placePopover puts a popup below its anchor, above when there is no room, at the anchor's start edge; CSS anchor positioning is not used. |
| Menu | An anchor slot and element entries (camo-menu-item, camo-menu-divider, camo-menu-group exclusive). The anchor announces "has popup" and expanded; arrows, Home, End and typeahead move; a click or Enter runs the item's click and closes; checkable items are menu item checkboxes or, in an exclusive group, radios. |
| Tooltip | Hover after a delay, keyboard focus at once; Escape, blur and press hide it; hoverable; never takes focus; the text is the anchor's description, not its name. |
| Paged list | state = { items, loading, endReached, error }, renderItem, itemKey; camo-load-more once per state near the end, camo-retry, camo-refresh (pull on touch); skeletons hidden from assistive technology, one live status. No virtualization. |
| Select | A text field plus a panel (no renderer of its own): camo-option children or an options property, searchable, async through loading, selected-label, camo-open, camo-query (debounced) and camo-load-more; a menu as wide as the field or a sheet (auto by window width and more than seven options). |
| Skeleton | No group element: every skeleton starts its cycle at the same moment of the page's clock. Stops under reduced motion. |
| Top bar | scroll-offset is a distance; scroll-target follows a scroller; Cupertino collapses a large title; title-content replaces the drawn title and the heading stays. |
| Host cannot see its children | :host(:has(...)) is not in every engine and a server has no light DOM: slotted widgets are styled from the shadow root with ::slotted, and a gap belongs to the widget. W1's and W2's button rule for icons was dead in Chromium and is fixed. |
| Gaps | A wheel inside a select sheet and a date wheel; context menus; submenus, popover, side sheet and command palette (W6); the structural theme fields; refreshKeepsItems and itemFadeIn. |
11. What W5 settled (srctool/camouflage-web, milestone W5)
| Finding | Decision |
|---|---|
| Progress | camo-progress-bar and camo-progress-circle take progress (0 to 1, clamped); none is indeterminate. A progressbar with a value and a percentage, or with no value while unknown. Animations are CSS; under reduced motion each becomes a slow pulse. Cupertino's unknown circle is twelve fading spokes. |
| Snackbar | A messenger, not a component: messengerOf(el).show(message, { action, tone, duration, withDismiss }) returns a promise of "action" or "dismissed"; one messenger per provider, one message at a time in the top layer, the timer held while hovered or focused, dismissCurrent(), swipe to dismiss; --camo-messenger-inset-bottom and -top replace CamoMessengerInsets. Minimal at the bottom, Cupertino a banner at the top. Polite announcement, assertive for error and warning. |
| Banner | The tone's status icon is slot fallback (icon slot replaces it); tone-info, tone-success, tone-warning and tone-error registered icons change them for banner and snackbar. status for info and success, alert for warning and error. Quiet buttons in actions take the banner's accent through --camo-action-color. dismissible adds a ✕ and fires camo-dismiss. |
| Chip | One element: selectable (filter; the app flips selected from click), removable (input chip, camo-remove, Delete and Backspace), clickable (action), none (tag). The ✕ is a real button except inside a chip that is itself a button. camo-chip-group is form-associated: a radio group for one choice (required keeps the last on) or toggle buttons for multiple; layout="scroll" is one scrolling row. A 48 px touch area around the 32 px chip. |
| Badge | count (absent is a dot, 0 or less draws nothing, above max reads "99+") and camo-badged-box anchoring it at the top-end corner (mirrored in right-to-left); the badge is hidden from assistive technology there and its text becomes the anchor's description. |
| Avatar | avatarInitials and avatarColorSeed (FNV-1a of the UTF-8 bytes; "Dwiki Riyadi" is 0xCDC853E9) are pure and shared with Kotlin and Dart; the photo is the app's <img slot="image">; initials until it loads. camo-avatar-group hides what is past max by CSS and adds a "+N" avatar once it has hydrated. |
| FAB | collapsed folds an extended FAB (the name stays), hidden scales it out and takes it out of focus and reading; Minimal a flat rounded square, Cupertino a circle. |
| Tabs | camo-tabs with camo-tab children: arrows select, a cancelable camo-before-change then change, one indicator measured by the container and slid with CSS (a tab draws its own until then, and on the server). Cupertino is a segmented control; a scrolling bar uses the underline. |
| Navigation | camo-nav-item (value, label, icon, selected-icon, a badge slot) in camo-navigation-bar, -rail and -drawer (with camo-nav-section), landmarks of links with aria-current="page", not tabs. The selection, roving and events are shared (NavigationController); picking the current item fires camo-reselect. camo-modal-drawer is the overlay frame from the start edge. |
| Names | expanded is the inverted collapsed (FAB), visible is hidden (FAB, navigation bar), indicatorSize is indicatorWidth and indicatorHeight; title of a nav section is read and removed like the dialog's. |
| Gaps | CamoAdaptiveNavigation and an edge swipe to open the drawer; a snackbar is inert behind an open modal dialog; a screen reader's longer snackbar timeout; the structural theme fields (progress showStopIndicator, snackbar position, alignment, showDismiss, showToneIcon, banner accentBorder, toneIcons, chip showCheckWhenSelected, badge defaultTone, avatar shape, FAB size, tabs indicatorWidth, the chrome placement, indicator, showLabels). |
12. What W6 settled (srctool/camouflage-web, milestone W6)
| Finding | Decision |
|---|---|
| Parts a renderer draws | A renderer is pure, so it writes data-part (and data-key, data-id, data-index) on what is pressed and the element listens once on itself (the split button's parts, pagination, the carousel's buttons, the uploader's zone and rows, the table's sort headers). |
| Popover | One pure placement function: below, then above; a side asked for (start and end follow the writing direction), then the opposite, then below; centered on the anchor and kept inside the window; it returns the physical side and where the anchor's center is, for the arrow. Click on the anchor toggles; outside click and Escape close; focus returns to the anchor; "has popup", expanded. |
| Button group and split button | Connected by default (spaced is the inverted connected); the group passes its corners to the buttons through inherited properties, so a server render is already joined. The split button is two real buttons and the real menu, opening under the whole button; menu-only is a menu button. |
| Side sheet and toolbar | camo-side-sheet docked (complementary region, scrolling content, pinned actions) and camo-modal-side-sheet in the overlay frame from the end edge. The toolbar's actions are camo-icon-buttons: those that do not fit fold, in order, into a "more" menu with their labels, tones, disabled state and a checkmark for a toggle. |
| Image, rating, carousel | The image shows the browser's <img> in the skin's frame (placeholder, fade, error mark; no description means decorative). The rating is form-associated and adjustable (a slider; an image when read-only). The carousel is a scroll-snap strip with the strip as its one Tab stop, inert items out of sight, a page read when the scroll settles, and opt-in autoplay that stops for good once the user steps. |
| File uploader | The zone is one button firing a cancelable camo-pick; picked and dropped files arrive in camo-files-dropped and are the form value; the app sets files rows (progress, remove, retry, a failed row announced once). |
| Data table and tree | A real <table role="grid"> (sticky header, aria-sort, selection by a Set or a list of keys, sorting the app's); a flat list of treeitems with level, place and expanded state, lazy loading asked once. Both take object properties, which render on the server but hydrate only when set before the element upgrades. |
| Pagination, breadcrumb, steps | pageItems keeps a fixed length of 2 * siblings + 5; the arrows move focus without choosing. The breadcrumb's items are data holders, the trail is drawn and folded by the breadcrumb (planBreadcrumb). Steps take their state from current; only clickable ones are buttons; index and count reflect for a server render. |
| Names | connected is the inverted spaced, showIndicator the inverted hide-indicator; onClose is camo-close, onPageChange is camo-page-change; page counts from 0; the table's selection is a Set or a list. |
| Gaps | Virtualization, content-measured and resizable columns, row expansion and cell editing; checkbox trees and range selection; a rich tooltip; the toolbar's labels, hide on scroll and vertical form; the structural theme fields (popover showArrow, toolbar placement, table density, tree showLines, and the rest of the list in the findings). |
13. What W7 settled (srctool/camouflage-web, milestone W7)
| Finding | Decision |
|---|---|
| Package | @srctool/camouflage-charts depends on core only; /define registers camo-chart-frame, camo-chart-data-table, camo-sparkline, camo-line-chart, camo-bar-chart, camo-pie-chart and camo-charts-provider. Charts are not in the skin contract |
| Drawing | By fractions, so nothing is measured: a stretched SVG with non-scaling strokes for lines and areas, boxes at percentages for bars, dots and labels, a square SVG for the pie. The server's drawing is right at any width and hydration moves nothing |
| Data | JSON attributes (categories, series, slices, values), or properties; the server and the browser read the same data before the first render. Functions (axis and value formats) are properties only |
| Style | The theme's defaults, the preset for the skin's name, the theme's tokenSets.chart, then chart-style. The palette is live color-family variables, leaving out those under 3:1 with the surface |
| Accessibility | A plot is role="application" (not an image, so arrow keys reach it), named by the title and a generated summary, with the focused point said in a live region. A sparkline is an image. The table fallback is camo-chart-data-table |
| Replacing the drawing | <camo-charts-provider .renderer=…>; the frame, axes, legend, keys and tables stay |
| Right-to-left | Logical properties and one mirrored SVG; a time axis stays left to right and a pie keeps turning clockwise |
| A W4 bug | A card or list item that was not clickable cancelled every click inside it. Now it blocks only its own click; a disabled one still blocks everything |
| Gaps | Zoom, pan and brush; dual y axes; patterns as a second cue beside color; the skin's tooltip renderer; label thinning on a server; gauges and reference bands |
14. What W8 settled (srctool/camouflage-web, milestone W8)
| Finding | Decision |
|---|---|
| Packages | skin-material, skin-fluent and skin-carbon join Minimal and Cupertino, each on core only. Theme factories that need the color library are a /factory entry, since plain Node cannot load it |
| How a skin is written | Most renderers are core's shared base with the skin's defaults(theme) and a little CSS on its parts; button and dialog are the skin's own |
| Options | createMaterialSkin({ expressiveProgress }), createCupertinoSkin({ surface }) (classic or liquid-glass), createFluentSkin({ surface }) (solid, acrylic, mica). cupertinoSkin is now Classic with blurred bars, sheets and menus |
| Capabilities in CSS | The provider writes --camo-blur-supported, --camo-glass-refraction, --camo-material-texture, --camo-window-material and --camo-input-pointer after hydration; the server writes none, so the first paint is opaque and touch-sized |
| Refraction | An SVG displacement filter inside backdrop-filter, in Chromium only (userAgentData); elsewhere glass keeps blur and edge |
| Density | Fluent (32 pointer, 40 touch) and Carbon (40, 48) follow the input in CSS; fluentTheme({ density }) and carbonTheme({ density }) fix it |
| Ripple | The press controller leaves the pointer's position in --camo-press-x and --camo-press-y |
| Colors changed for contrast | Fluent: dark error text #ee8f94, light warning #bc4b09. Carbon: dark error #ff8389, the light theme's inverse link #78a9ff; banner actions are link blue |
| Core bugs found | A line or dot navigation indicator squashed the icon; a bottom sheet's close button stacked under the title and left an empty heading when untitled; a removed tooltip threw; a side-aligned snackbar did not center below 600 |
| Gaps | No time-picker dial or date wheel; no Material switch icons; no Fluent dialog close button; Carbon steps a nested tile one layer only; Liquid Glass not measured on a mid-range device; Mica untested against a window material |
Material availability on the web
| Skin | Surfaces, best first | Needs |
|---|---|---|
| Minimal, Material, Carbon | flat, paper, layered | nothing |
| Cupertino Classic | blur, opaque | backdrop-filter |
| Cupertino Liquid Glass | refraction, blur and edge, Classic blur, opaque | refraction: Chromium in a secure context |
| Fluent Acrylic | blur, tint and grain; grain over solid; Solid | backdrop-filter |
| Fluent Mica | the window's material, Solid | a window material; a web page has none |
Reduce Transparency ends every chain at the opaque surface.
15. What W9 settled (srctool/camouflage-web, milestone W9)
| Finding | Decision |
|---|---|
| Submenus | camo-menu-submenu (text, open, disabled) inside a menu, any depth. Its child is a nested popover="auto", so Escape and a click outside behave natively. Hover opens after 250 ms and closes after a 120 ms grace |
| Split pane | camo-split-pane with camo-pane children. Each pane carries its own size, min-size, max-size, collapsible and draws the divider after itself, so a server draws the split from attributes. fractions saves and restores; camo-resize reports |
| Separator | The divider is a real separator with a percentage value, which the web has and Compose and Flutter do not |
| Scrollbar | camo-scrollbar is the scroll area itself. With a mouse the platform bar is hidden by CSS (so nothing moves at hydration) and the skin's is drawn; touch and no-script keep the platform's. Camouflage's own scroll containers use the platform's bar in the theme's colors, not the skin's renderer |
| Density | A generic `density="xs |
| Renderers | 60 on the web with splitPane and scrollbar |
| Gaps | No safe triangle for the pointer path to a submenu; no scroll adapters for virtualized lists; the drawn scrollbar is not wired into the tree, table or lists; Carbon xs keeps 14 px text; the macOS "show scroll bars" setting is not read |