Skip to Content
BBRICKSv0.7.4
PR PortalStatus and icons

DecisionLine

A muted line of decision tags between two blocks (the v3 mock's <div class="muted"> with dt('P6')dt('P7')… under the customer affiliates switch): the open decisions a whole section waits on. Drawn only while the nearest DecisionTagsProvider shows tags (the sidebar's "Show decision tags" switch); otherwise nothing, taking no room.

import { DecisionLine } from '@ergasti/bricks';

Examples

Decision line

The open decisions a section waits on, as a muted line of tags, drawn only while the sidebar's "Show decision tags" is on (a DecisionTagsProvider). Flip the switch.

Code
import { useState } from 'react';
import { DecisionLine, DecisionTagsProvider, Switch } from '@ergasti/bricks';

const DECISIONS = [{ id: 'P6', question: 'Who can pause a program?' }, { id: 'P7', question: 'Can a brand end a campaign early?' }, { id: 'R7', question: 'Who can edit a program?' }];

function Line() {
  const [show, setShow] = useState(true);
  return (
    <DecisionTagsProvider visible={show}>
      <Switch label="Show decision tags" checked={show} onChange={setShow} />
      <DecisionLine codes={['P6', 'P7', 'R7']} decisions={DECISIONS} />
      <DecisionLine codes={['P6', 'P7']} decisions={DECISIONS} variant="open" />
    </DecisionTagsProvider>
  );
}

Between two blocks

spacing="pull" in a PageGrid (or any 16px-gap column): shown, the line sits 4px under the card above and 12px over the next; switched off, it takes no room and the two cards are 4px apart.

Code
import { useState } from 'react';
import { Card, DecisionLine, DecisionTagsProvider, PageGrid, Switch } from '@ergasti/bricks';

const DECISIONS = [{ id: 'P6', question: 'Who can pause a program?' }, { id: 'P7', question: 'Can a brand end a campaign early?' }, { id: 'R7', question: 'Who can edit a program?' }];

function BetweenBlocks() {
  const [show, setShow] = useState(true);
  return (
    <DecisionTagsProvider visible={show}>
      <PageGrid>
        <Switch label="Show decision tags" checked={show} onChange={setShow} />
        <Card title="Customer affiliates">Customers can earn on their own orders.</Card>
        <DecisionLine codes={['P6', 'P7', 'R7']} decisions={DECISIONS} spacing="pull" />
        <Card title="Programs">Every brand's affiliate program.</Card>
      </PageGrid>
    </DecisionTagsProvider>
  );
}

Props

Prop

Type

Design guidance

How the BRICKS design system uses DecisionLine. Written in docs/content/components/DecisionLine.md; the props above are read from the code, which wins where the two disagree.

A muted line of open-decision tags between two blocks, for the product decisions a whole section waits on; it draws only while "Show decision tags" is on.

DecisionLine is the PR v3 mock's <div class="muted" style="margin:-12px 0 12px"> holding dt('P6')dt('P7')dt('R7') under the customer affiliates switch on Affiliate programs, and dt('R2') over the Activity log table. It reads the nearest DecisionTagsProvider (the sidebar's "Show decision tags" switch) and renders nothing when tags are hidden. spacing="pull" reproduces the mock's negative margins inside a 16px-gap stack, so turning tags off closes the gap instead of leaving a hole.

Anatomy

  1. Line: a <p> (.kit-pr-muted .kit-pr-dline), 12px --ink-3.
  2. Tags: one DecisionTag per code, in order: small sky tags (tag) or butter "Open · P6" pills (open).
  3. Gap marker (spacing="pull", hidden): an empty aria-hidden <div class="kit-pr-dline-gap">, display: none, that pulls the next block up 12px.

Variants

PropValueLookWhen to use
varianttag (default)Sky code tags (the mock's dt())Inline references to decisions
openButter dashed "Open · P6" pills, focusable for their questionA section blocked on a decision (the screens' choice)
spacingnone (default)A block of its own; hidden, nothingAnywhere outside a 16px-gap stack
pullShown: 4px under the block above, 12px over the next. Hidden: the next block sits 4px under the one aboveBetween blocks of a PageGrid, a 16px-gap column or the AppShell content

States

StateTrigger
Shownthe provider shows tags, or visible
Hiddenthe provider hides tags, or visible={false}: nothing (or the gap marker with pull)
Emptycodes=[]: same as hidden
No pullthe marker is the stack's first child, or sits in a multi-column PageGrid (c2–c4, 8-4, 7-5, 6-6)

Usage

import { useState } from 'react';
import { Card, DecisionLine, DecisionTagsProvider, PageGrid, Switch } from '@ergasti/bricks';

const decisions = [{ id: 'P6', question: 'Who can pause a program?' }, { id: 'P7', question: 'Can a brand end a campaign early?' }, { id: 'R7', question: 'Who can edit a program?' }];

export function ProgramsHead() {
  const [show, setShow] = useState(true);
  return (
    <DecisionTagsProvider visible={show}>
      <PageGrid>
        <Switch label="Show decision tags" checked={show} onChange={setShow} />
        <Card title="Customer affiliates">Customers can earn on their own orders.</Card>
        <DecisionLine codes={['P6', 'P7', 'R7']} decisions={decisions} variant="open" spacing="pull" />
        <Card title="Campaigns">One active campaign per brand.</Card>
      </PageGrid>
    </DecisionTagsProvider>
  );
}
// A code with its question inline beside a bare code (no question), always drawn
import { DecisionLine } from '@ergasti/bricks';

export function AlwaysShown() {
  return <DecisionLine codes={[{ id: 'P6', question: 'Who can pause a program?' }, 'R2']} visible />;
}

Where it appears

  • PR Portal › Affiliate programs › Campaigns, under the customer affiliates switch (P6, P7, R7). Screen: PR · Affiliate programs.
  • PR Portal › Activity log, over the toolbar (R2). Screen: PR · Activity log.
  • Both screens use variant="open" and spacing="pull".

Guidelines

Do

  • Pass the same decisions list the DecisionsCard shows, so the tags carry their questions.
  • Use spacing="pull" inside a 16px-gap stack; put the line inside a column in a multi-column grid.
  • Keep it for decisions that cover a whole section; tag a single label with DecisionTag.

Don't

  • Don't force visible on production screens; the tags are for reviews.
  • Don't add other text to the line; it holds tags only.

RTL and Arabic

The tags flow right to left and keep their inline-start gap. Codes stay Latin ("P6"); the "Open" word and screen-reader text come from DecisionTag's Arabic copy, and questions are dir="auto" in the tooltip.

Tokens

--ink-3 (line), --sky, --sky-ink (tag), --butter, --butter-ink (open).

Accessibility

  • tag tags show the code visually and read "Open decision P6" plus the question (screen-reader text); the question is also the title.
  • open pills with a question and tip="focus" are a tab stop with a role="tooltip" on hover and focus; Escape hides it.
  • The hidden gap marker is aria-hidden and takes no room.

Found in the source

  • ARIA attributes set: aria-hidden.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: useDecisionTagsVisible · Switch · PageGrid · Card · IconSquare · PrCountPill

Source

src/pr/decisions/DecisionLine.tsx (line 32) on GitHub.

On this page