Skip to content

Search

Start typing to search.


Show all pages

Documentation

controls

Editor

A text field with a toolbar for bold, italic, headings, lists and links.

Rich widgetNeeds a script for its behavior.

Usage

A toolbar, an editable area and a hidden input that carries the HTML with the form. Select text and use the toolbar, or Ctrl B and Ctrl I.

Lesson notes

Practised roundabouts and merging on the ring road.

HTML

Examples

Guidance and accessibility

When to use

  • Use the editor for short formatted text, such as notes, descriptions or messages, where bold, lists and links help.
  • For plain text, use a text area. For long documents, a full editor fits better.
  • Always sanitize the HTML on the server before you store or show it.

Accessibility

  • The toolbar is one tab stop: arrow keys, Home and End move between tools. Each tool has a name, and formats such as bold say whether they apply with aria-pressed.
  • The editable area has role="textbox", aria-multiline="true" and a visible label connected with aria-labelledby.
  • The link tool opens a small form with a labelled field; Escape closes it.
  • Paste inserts plain text, so the content keeps the editor’s own styles.
  • Formatting uses document.execCommand, which every browser supports in editable areas although it is marked legacy.

Classes

Generated from the component contract. Parts use __, modifiers use --.

Classes of the editor component
ClassKindUse it for
ca-editorComponentFrame around the toolbar and the editable area.
ca-editor__toolbarPartThe role="toolbar" of formatting tools.
ca-editor__toolPartOne button with data-command; formats show their state with aria-pressed.
ca-editor__contentPartThe contenteditable area with role="textbox".
ca-editor__linkPartThe [popover] form that asks for a link address.

Skins

The same markup, dressed by each skin. Structure and behavior stay the same; only the look changes.

Base skin

Neutral grayscale starting point; product skins extend it and change what differs.

Lesson notes

Practised roundabouts and merging on the ring road.

Calaca skin

The Calaca UI brand: hueso paper and tinta ink, cempasúchil marigold, rosa and jade.

Lesson notes

Practised roundabouts and merging on the ring road.

Proof skin

Pilot skin pushed far from base: square, heavy, offset shadows, larger targets.

Lesson notes

Practised roundabouts and merging on the ring road.

Crossview skin

The CrossView proofing table: cool ground, bond-paper sheets, rule-grey hairlines, one red mark.

Lesson notes

Practised roundabouts and merging on the ring road.

Framework notes

Link the prebuilt stylesheet of your skin next to your brand theme. No build step.

HTML
<link rel="stylesheet" href="theme.css" />
<link rel="stylesheet" href="ca-base.css" />