DecisionTagsProvider
Whether the inline DecisionTags under it are drawn: the "Show decision tags" switch of the sidebar's DecisionsCard sets it for the whole app. Without a provider the inline tags stay hidden (the mock's default).
import { DecisionTagsProvider } from '@ergasti/bricks';Examples
Open decisions
DecisionsCard sits in AppShell's sidebarCard slot: the open codes (each one's question is its tooltip) and a switch. The app keeps the switch's state and hands it to a DecisionTagsProvider around the page, so every inline DecisionTag shows or hides with it. variant="open" is the "Open · R10" pill that always shows, in place of a value nobody has decided.
Code
import { useState } from 'react';
import { Card, DecisionTag, DecisionTagsProvider, DecisionsCard } from '@ergasti/bricks';
const OPEN = [
{ id: 'C3', question: 'Can a brand opt out of a TRNDR-wide challenge?' },
{ id: 'R10', question: 'What a tier gives creators' },
{ id: 'S4', question: 'Can PR add or remove tiers?' },
{ id: 'T4', question: 'When challenge rewards are paid' },
{ id: 'GS1', question: 'Damaged or extra units: brand collects within 14 days?' },
{ id: 'GS2', question: 'Can PR launch a gift challenge with fewer gifts than planned?' },
];
function Sidebar() {
const [show, setShow] = useState(true);
return (
<DecisionTagsProvider visible={show}>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(248px, 1fr))', gap: 16, alignItems: 'start' }}>
<div style={{ maxWidth: 248, padding: 14, borderRadius: 18, background: '#141414' }}>
<DecisionsCard decisions={OPEN} showTags={show} onShowTagsChange={setShow} />
</div>
<Card>
<Card.Header title={<>Needs you<DecisionTag id="S12" /></>} sub="Most urgent first" />
<p style={{ margin: 0 }}>Affiliate program<DecisionTag id="P6" question="Who can change a program?" /></p>
<p>What creators get: <DecisionTag id="R10" question="What a tier gives creators" variant="open" /></p>
</Card>
</div>
</DecisionTagsProvider>
);
}Codes you can focus
tip="focus" makes each code a tab stop that shows its question in its own tooltip on hover and keyboard focus (Escape hides it), so keyboard users can read it too. The default 'title' uses the browser's tooltip, which only a mouse shows.
Code
import { useState } from 'react';
import { DecisionsCard } from '@ergasti/bricks';
const OPEN = [
{ id: 'C3', question: 'Can a brand opt out of a TRNDR-wide challenge?' },
{ id: 'R10', question: 'What a tier gives creators' },
{ id: 'S4', question: 'Can PR add or remove tiers?' },
{ id: 'T4', question: 'When challenge rewards are paid' },
{ id: 'GS1', question: 'Damaged or extra units: brand collects within 14 days?' },
{ id: 'GS2', question: 'Can PR launch a gift challenge with fewer gifts than planned?' },
];
function FocusTips() {
const [show, setShow] = useState(false);
return (
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(248px, 1fr))', gap: 16, alignItems: 'start' }}>
{(['title', 'focus'] as const).map((tip) => (
<div key={tip} style={{ maxWidth: 248, padding: 14, borderRadius: 18, background: '#141414' }}>
<DecisionsCard decisions={OPEN.slice(0, 4)} tip={tip} showTags={show} onShowTagsChange={setShow} />
</div>
))}
</div>
);
}Props
Prop
Type
Accessibility
- Roles in the markup:
tooltip. - ARIA attributes set:
aria-describedby,aria-hidden.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
useLanguage · Sidebar · DecisionsCard · Card · DecisionTag · DecisionLine · IconSquare · PrCountPill
Source
src/pr/decisions/DecisionTag.tsx (line 35) on GitHub.