Create a new EDS 2.0 component named $ARGUMENTS in packages/eds-core-react/src/components/next/.
Canonical reference:
documentation/agent-instructions/BUILDING_EDS_2_COMPONENTS.md— foundation data-attributes, critical patterns, file templates, common mistakes, advanced patterns, and the anti-patterns checklist. Project-wide conventions live inAGENTS.md.
@../../documentation/agent-instructions/BUILDING_EDS_2_COMPONENTS.md
This command focuses on the per-component scaffolding flow. The patterns and code templates referenced below all live in the canonical doc above — read them there rather than inferring from memory.
-
Ask for a Figma URL for the component design. If provided, run the Figma MCP tools per
AGENTS.md§ Figma MCP workflow:figma_get_design_context— component structurefigma_get_screenshot— visual referencefigma_get_variable_defs— tokens per state (Default, Hover, Focus, Disabled, and any other state in the design). Use the EXACT variable names returned.
-
Check the component index first —
documentation/AI-COMPONENT-INDEX.mdlists every existing/nextcomponent with its props and sub-components (generated, CI-verified). Confirm$ARGUMENTSdoesn't already exist, and prefer composingField,Icon,Input,Button,Typographyover reinventing. The underlying source of truth ispackages/eds-core-react/src/components/next/index.ts. -
If an old component exists at
packages/eds-core-react/src/components/$ARGUMENTS/, read it for behavioural awareness (keyboard nav, focus management) only — do not copy implementation. Use modern patterns::focus-visible, CSS tokens, simple state. -
Create the component folder with all required files using the templates in
BUILDING_EDS_2_COMPONENTS.md:$ARGUMENTS/ index.ts $ARGUMENTS.tsx $ARGUMENTS.types.ts <lowercase>.css (e.g. avatar.css) $ARGUMENTS.figma.tsx (only if a Figma URL was provided) $ARGUMENTS.test.tsx $ARGUMENTS.stories.tsxSubstitute
$ARGUMENTSfor the component name and use the lowercase form for the CSS filename and class root (eds-avatar, noteds-Avatar). -
Wire into the package per
BUILDING_EDS_2_COMPONENTS.md:- Export from
next/index.ts @importthe CSS innext/index.css
- Export from
-
Emit an Implementation Status Report per
BUILDING_EDS_2_COMPONENTS.md— a short## Implementation notessection summarising what came from Figma, what was inherited, what was assumed, what was skipped, and any TODOs.
These are the patterns most often forgotten — full rationale in the canonical doc:
data-color-appearancegoes on the smallest element that uses that colour, not the root.- Elements with
data-color-appearancemust set acolor(orbackground-color) using a dynamic token. - For disabled icons that were accent when enabled: change
data-color-appearancetoneutraland use--eds-color-text-disabled. Never useopacityfor disabled. data-space-proportionsis calculated from Figma padding (horizontal vs vertical), not copied from a similar component.data-baseline="center"enables text-box-trim so component height matches Figma.- Use EXACT
--eds-*tokens fromfigma_get_variable_defs— never hardcode hex or pixel values. - Never put
data-font-familyon a flex container — it setsdisplay: blockand breaks layout.