VERIFICATION-0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
Applicability rule · Extended localized content for verification and layout resilience
Define when this section is shown.
Meaning: Show this section when Answer(Q1) = Yes.
<forma-rule-builder>
Field/operator/value clauses for typed rule editing while the application owns expression semantics.
<forma-rule-builder>patterns/rule-builder.htmlA rule builder lets users compose a condition from clauses, each a field, an operator and a value, combined in AND/OR groups, with a plain-language summary of what the rule means. Forma provides the visual contract: a bordered panel with a header, groups with a visible operator badge, clause rows laid out as a grid of labelled native selects or inputs, and a summary bar. Adding and removing clauses, which operators and values a field allows, validation, the expression model and its serialization all belong to the application (Limen/Ordo); Forma never interprets the rule.
The smallest correct markup: the canonical pattern from patterns/rule-builder.html inside its public tag. Copy this first, then adapt labels, names and state.
Rendered from the canonical pattern file.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
Define when this section is shown.
Meaning: Show this section when Answer(Q1) = Yes.
<forma-rule-builder class="forma-component-tag">
<section class="forma-rule-builder" aria-labelledby="rule-builder-title">
<header class="forma-rule-builder__header">
<div>
<h2 id="rule-builder-title">Applicability rule</h2>
<p>Define when this section is shown.</p>
</div>
<button type="button">Add condition</button>
</header>
<div class="forma-rule-group" data-forma-operator="and">
<div class="forma-rule-group__operator" aria-label="All conditions must be true">AND</div>
<div class="forma-rule-clause">
<label>
<span>Field</span>
<select>
<option>Answer: Q1</option>
</select>
</label>
<label>
<span>Operator</span>
<select>
<option>is equal to</option>
</select>
</label>
<label>
<span>Value</span>
<select>
<option>Yes</option>
</select>
</label>
<button type="button" aria-label="Remove condition">Remove</button>
</div>
</div>
<p class="forma-rule-builder__summary"><strong>Meaning:</strong> Show this section when Answer(Q1) = Yes.</p>
</section>
</forma-rule-builder>
Click or tap the code once to select all of it, then copy.
An AND group containing one clause and a nested OR group of two clauses. Each group is a named role=group, the visible operator badge is hidden from assistive technology because the group name says the same thing, and remove buttons name their clause.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
Tickets that match go to the priority queue.
Meaning: Route to the priority queue when the plan is Enterprise and either severity is Critical or the ticket has been open more than 4 hours.
<forma-rule-builder class="forma-component-tag">
<section class="forma-rule-builder" aria-labelledby="rule-builder-nested-title">
<header class="forma-rule-builder__header">
<div>
<h2 id="rule-builder-nested-title">Escalation routing</h2>
<p>Tickets that match go to the priority queue.</p>
</div>
<button type="button">Add condition</button>
</header>
<div class="forma-rule-group" data-forma-operator="and" role="group" aria-label="All of these conditions (AND)">
<p class="forma-rule-group__operator" aria-hidden="true">AND</p>
<div class="forma-rule-clause">
<label><span>Field</span>
<select name="rule-1-field"><option selected>Customer plan</option><option>Region</option><option>Severity</option></select>
</label>
<label><span>Operator</span>
<select name="rule-1-operator"><option selected>is</option><option>is not</option></select>
</label>
<label><span>Value</span>
<select name="rule-1-value"><option selected>Enterprise</option><option>Business</option></select>
</label>
<button type="button" aria-label="Remove condition: Customer plan is Enterprise">Remove</button>
</div>
<div class="forma-rule-group" data-forma-operator="or" role="group" aria-label="Any of these conditions (OR)">
<p class="forma-rule-group__operator" aria-hidden="true">OR</p>
<div class="forma-rule-clause">
<label><span>Field</span>
<select name="rule-2-field"><option>Customer plan</option><option>Region</option><option selected>Severity</option></select>
</label>
<label><span>Operator</span>
<select name="rule-2-operator"><option selected>is</option><option>is not</option></select>
</label>
<label><span>Value</span>
<select name="rule-2-value"><option selected>Critical</option><option>High</option></select>
</label>
<button type="button" aria-label="Remove condition: Severity is Critical">Remove</button>
</div>
<div class="forma-rule-clause">
<label><span>Field</span>
<select name="rule-3-field"><option>Customer plan</option><option>Region</option><option selected>Open hours</option></select>
</label>
<label><span>Operator</span>
<select name="rule-3-operator"><option selected>more than</option><option>less than</option></select>
</label>
<label><span>Value</span>
<input type="number" name="rule-3-value" min="0" value="4" inputmode="numeric">
</label>
<button type="button" aria-label="Remove condition: Open hours more than 4">Remove</button>
</div>
</div>
</div>
<p class="forma-rule-builder__summary"><strong>Meaning:</strong> Route to the priority queue when the plan is Enterprise and either severity is Critical or the ticket has been open more than 4 hours.</p>
</section>
</forma-rule-builder>
Click or tap the code once to select all of it, then copy.
The application rejected a clause with no value chosen. The empty value select is marked invalid and linked to a validation message; the summary says the rule cannot be applied yet instead of guessing its meaning.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
Show the follow-up section only to some respondents.
Meaning: Incomplete. The rule will not be applied until every condition has a value.
<forma-rule-builder class="forma-component-tag">
<section class="forma-rule-builder" aria-labelledby="rule-builder-incomplete-title">
<header class="forma-rule-builder__header">
<div>
<h2 id="rule-builder-incomplete-title">Section visibility</h2>
<p>Show the follow-up section only to some respondents.</p>
</div>
<button type="button">Add condition</button>
</header>
<div class="forma-rule-group" data-forma-operator="and" role="group" aria-label="All of these conditions (AND)">
<p class="forma-rule-group__operator" aria-hidden="true">AND</p>
<div class="forma-rule-clause">
<label><span>Field</span>
<select name="visibility-field"><option selected>Answer: Q4 Team size</option></select>
</label>
<label><span>Operator</span>
<select name="visibility-operator"><option selected>is at least</option></select>
</label>
<label><span>Value</span>
<select name="visibility-value" aria-invalid="true" aria-describedby="rule-builder-incomplete-error"><option value="" selected>Choose a value</option><option>10</option><option>50</option></select>
</label>
<button type="button" aria-label="Remove condition: Q4 Team size">Remove</button>
</div>
<p class="forma-validation-message" id="rule-builder-incomplete-error">
<span class="forma-validation-message__mark" aria-hidden="true">!</span>
Choose a value for this condition.
</p>
</div>
<p class="forma-rule-builder__summary"><strong>Meaning:</strong> Incomplete. The rule will not be applied until every condition has a value.</p>
</section>
</forma-rule-builder>
Click or tap the code once to select all of it, then copy.
Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.
A two-clause AND rule at phone width. The header and each clause stack so every control gets the full width.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
<forma-rule-builder class="forma-component-tag">
<section class="forma-rule-builder" aria-labelledby="rule-builder-mobile-title">
<header class="forma-rule-builder__header">
<div>
<h2 id="rule-builder-mobile-title">Campaign audience</h2>
<p>Who receives this announcement.</p>
</div>
<button type="button">Add condition</button>
</header>
<div class="forma-rule-group" data-forma-operator="and" role="group" aria-label="All of these conditions (AND)">
<p class="forma-rule-group__operator" aria-hidden="true">AND</p>
<div class="forma-rule-clause">
<label><span>Field</span>
<select name="audience-1-field"><option selected>Role</option></select>
</label>
<label><span>Operator</span>
<select name="audience-1-operator"><option selected>is</option></select>
</label>
<label><span>Value</span>
<select name="audience-1-value"><option selected>Administrator</option></select>
</label>
<button type="button" aria-label="Remove condition: Role is Administrator">Remove</button>
</div>
<div class="forma-rule-clause">
<label><span>Field</span>
<select name="audience-2-field"><option selected>Last sign-in</option></select>
</label>
<label><span>Operator</span>
<select name="audience-2-operator"><option selected>within</option></select>
</label>
<label><span>Value</span>
<select name="audience-2-value"><option selected>30 days</option></select>
</label>
<button type="button" aria-label="Remove condition: Last sign-in within 30 days">Remove</button>
</div>
</div>
<p class="forma-rule-builder__summary"><strong>Meaning:</strong> Administrators who signed in within the last 30 days.</p>
</section>
</forma-rule-builder>
Click or tap the code once to select all of it, then copy.
The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.
| Attribute | On | Values | Default | Description |
|---|---|---|---|---|
aria-labelledby | section.forma-rule-builder | id of the heading | — | Names the rule builder region with its visible heading. |
data-forma-operator | .forma-rule-group | and | or | — | Application-owned record of the group's logic, used by the pattern. Forma does not style it; the operator badge text is what users see. |
role | .forma-rule-group | group | — | Exposes the group and its accessible name to assistive technology. |
aria-label | .forma-rule-group / remove button | string | — | Names each group by its logic and each Remove button by its clause; keep the visible word Remove in the name. |
aria-hidden | .forma-rule-group__operator | true | — | Hides the visual badge when the group's aria-label already states the logic. |
aria-invalid | clause control | true | absent | Set by the application on an incomplete or invalid clause control. |
aria-describedby | clause control | id of the validation message | — | Links the clause error to the control. |
| Hook | Kind | Values or default | Description |
|---|---|---|---|
.forma-rule-builder | Block class | — | Root panel with a functional border on the primary surface. |
.forma-rule-builder__header | Element class | — | Header row with title and description on one side and actions on the other; stacks at 44rem and below. |
.forma-rule-builder__summary | Element class | — | Plain-language meaning bar on the secondary surface at the bottom of the panel. |
.forma-rule-clause | Block class | — | Four-column grid (field, operator, value, remove) with bottom-aligned controls; one column at 44rem and below. Direct labels become small label-over-control grids. |
.forma-rule-group | Block class | — | Padded grid of an operator badge and its clauses or nested groups. |
.forma-rule-group__operator | Element class | — | Monospace uppercase badge naming the group logic (AND, OR). |
| Keys | Result |
|---|---|
| Tab / Shift+Tab | Moves through the header action, each clause's controls and Remove buttons in source order. |
| Native control keys | Selects and inputs keep their native keyboard behavior. |
| Application | After Add or Remove, the application must move focus to the new clause's first control or to a sensible neighbor; Forma provides no focus management. |
| Event | Description |
|---|---|
change / click | Native events from clause controls and buttons. Building, validating and serializing the expression is application code; Forma adds no events. |
Clause controls are ordinary form controls and submit individually if inside a form. The structured expression is assembled and serialized by the application.
| State | How it is expressed | Presentation |
|---|---|---|
| Complete | every clause has values; summary states the meaning | The summary restates the rule in words. |
| Incomplete / invalid | aria-invalid on a clause control plus a linked .forma-validation-message | Error text with a non-color mark in the group; the summary says the rule cannot apply yet. |
| Nested group | .forma-rule-group inside .forma-rule-group | Inner group gets its own operator badge and padding; use nesting only when the logic requires it. |
| Focus | :focus-visible | Foundation focus ring on the focused control. |
minmax(8rem, …), so very narrow containers may need the stacked layout sooner than the breakpoint.min-inline-size: 0, so it shrinks inside grid and flex parents; the summary wraps.Generated fault-injection specimens expose content, spacing, color-cue, and reduced-effective-contrast risks. They screen presentation robustness as engineering screens without claiming human-subject validation.