# Design principles

The product and engineering decisions that keep Zenos coherent.

Zenos helps teams build dense, dependable product interfaces without hiding the platform beneath another layer of abstraction. Its components share one visual language and one public API, while remaining flexible enough for real application work.

The system separates responsibility deliberately. Native HTML supplies semantics, Base UI supplies complex interaction behavior, generated CSS applies the visual system, Zenos defines the public contract, and the consuming application owns product meaning and workflows.

## Core principles

**Clear before clever.** Names, states, and component anatomy should explain themselves at the call site. Familiar concepts use familiar vocabulary.

**Compose before abstracting.** Small public parts combine into real workflows. New abstractions earn their place through repeated product needs.

**Structure stays neutral.** Layout primitives control space and flow. Decoration remains an intentional choice made with semantic tokens.

**Behavior stays trustworthy.** Native and Base UI semantics survive styling, wrapping, polymorphism, and custom composition.

**Information leads.** Hierarchy, spacing, and contrast help people scan dense interfaces without unnecessary visual noise.

**Escape hatches remain useful.** Public components accept native props, `className`, `style`, ARIA attributes, and data attributes without exposing internals.

## Build from meaning

Use the element or component that matches the content's responsibility. A `Button` performs an action. A `Link` navigates. `Field` owns labels, descriptions, errors, and validation semantics. `InputGroup` only arranges related controls.

Visual similarity is not enough reason to merge responsibilities. Keeping boundaries narrow makes components easier to combine, test, and replace.

When a component starts to own data fetching, authorization, product copy, and several unrelated layouts, split it by responsibility rather than adding more configuration props.

## Prefer semantic decisions

Components use roles such as `background`, `surface`, `foreground`, `border`, and `primary`. They do not depend on a specific shade working in every theme. The same rule applies to spacing, elevation, typography, and status colors.

Primitive values remain available for theme authors. Product code should prefer semantic tokens so light mode, dark mode, and custom themes preserve the intended hierarchy.

Hardcoded values are appropriate only when they represent fixed content rather than a theme decision. A logo's authored color may be fixed; a success message should use the semantic success role.

## Reveal structure through composition

Compound components expose meaningful parts such as `Root`, `Trigger`, `Content`, `Item`, and `Indicator`. Consumers can arrange those parts around their content without depending on private wrappers.

```tsx
<Dialog.Root>
  <Dialog.Trigger render={<Button />}>Review changes</Dialog.Trigger>
  <Dialog.Content>
    <Dialog.Title>Publish changes?</Dialog.Title>
    <Dialog.Description>The update will be visible to every member.</Dialog.Description>
    <Dialog.Close>Cancel</Dialog.Close>
  </Dialog.Content>
</Dialog.Root>
```

Layout uses the polymorphic `as` prop. Base UI-backed interactive parts use `render`. Keeping these mechanisms distinct makes their purpose predictable.

## Design for real content

Zenos components must continue to work with long labels, empty results, validation errors, narrow containers, increased browser zoom, [RTL content](/foundations/rtl/), and reduced motion. Responsive behavior should follow the available space rather than assume one ideal screen.

Truncation is reserved for content that can safely lose visual detail. Essential instructions, errors, and actions should wrap or remain otherwise available.

## Make density support comprehension

Dense product interfaces should reduce wasted space, not remove hierarchy. Use proximity to group related information, alignment to make comparison easier, and contrast to identify the next decision. Give primary actions and exceptional states more emphasis than persistent chrome.

Do not solve density by shrinking every control or muting every label. Touch targets, focus indicators, readable type, and error recovery remain usable at compact densities. Test scanning with realistic data, not only symmetrical placeholders.

## Design every interaction state

A component is not finished at its default appearance. Review hover, pressed, selected, focused, disabled, invalid, loading, empty, and destructive states where they apply. The state must remain understandable through more than color alone.

Loading should preserve enough structure to prevent avoidable layout shift. Empty states should explain what is absent and, when appropriate, how to proceed. Destructive actions should communicate consequence before commitment and recovery after failure.

[Motion](/foundations/motion/) should explain spatial or state change, not delay work. Keep transitions interruptible, avoid motion that competes with reading, and provide an equivalent reduced-motion treatment.

## Accessibility is shared work

Zenos preserves native HTML and Base UI behavior, including keyboard interaction, focus management, ARIA relationships, and disabled semantics. Consumers remain responsible for meaningful labels, useful error messages, logical workflows, and content order.

Automated checks catch common regressions. Keyboard testing, screen-reader review, zoom, contrast, motion, and real content remain part of the design process.

Accessibility is a constraint throughout design, implementation, and content—not a final audit. A visually elegant treatment that obscures a label, removes focus, breaks source order, or depends on pointer precision is not a valid system outcome.

## Keep specialized engines optional

Calendar, carousel, chart, and data-table behavior comes from focused third-party engines installed through recipes. These dependencies are added only when a product requests the corresponding recipe, and the generated source belongs to that product.

Core Zenos stays focused on general-purpose controls, layout, tokens, and interaction patterns.

## Public API contract

| Concern                 | Convention                                                     |
| ----------------------- | -------------------------------------------------------------- |
| Layout polymorphism     | `as`                                                           |
| Interactive composition | `render`                                                       |
| Value state             | `value`, `defaultValue`, `onValueChange`                       |
| Open state              | `open`, `defaultOpen`, `onOpenChange`                          |
| Visual treatment        | `variant`                                                      |
| Control sizing          | `size="sm"`, `size="md"`, or `size="lg"`                       |
| Interaction orientation | `orientation="horizontal"` or `orientation="vertical"`         |
| State semantics         | `disabled`, `invalid`, `required`                              |
| DOM identification      | `data-slot`, plus `data-size` and `data-variant` when relevant |
| Styling escape hatches  | `className`, `style`, `aria-*`, and `data-*`                   |

Consistency is a product feature. A new API should reuse these conventions unless the underlying concept is genuinely different.

## Review a design-system change

Before accepting a new component, variant, token, or pattern, ask:

1. Does it have one clear owner and responsibility?
2. Can an existing public component or composition already express the need?
3. Does the API match established state, size, variant, and composition conventions?
4. Are native props, refs, keyboard behavior, focus, and ARIA relationships preserved?
5. Does it work with real content, responsive containers, themes, zoom, RTL, and reduced motion where relevant?
6. Are specialized dependencies isolated from the core package?
7. Do examples, types, tests, and rendered behavior prove the same public contract?

Prefer the smallest complete addition. A narrow primitive with a stable responsibility is easier to compose and maintain than a broad component that predicts every future product need.

Source: https://zenos-ui.pages.dev/foundations/