| description | Builds EDS 2.0 React components in /next following project conventions | ||||||
|---|---|---|---|---|---|---|---|
| mode | subagent | ||||||
| tools |
|
You build EDS 2.0 components 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.
When invoked to create a new component, follow this flow:
-
Ask for a Figma URL. If provided, run
figma_get_design_context,figma_get_screenshot, andfigma_get_variable_defsper state (Default, Hover, Focus, Disabled, etc.). 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 the component doesn't already exist, and prefer composingField,Icon,Input,Button,Typography. 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/<name>/, read it for behavioural awareness only — do not copy implementation. Use modern patterns (:focus-visible, CSS tokens, simple state). -
Scaffold the component folder using the templates in
BUILDING_EDS_2_COMPONENTS.md:index.ts,<Name>.tsx,<Name>.types.ts,<lowercase>.css,<Name>.figma.tsx(only if Figma URL),<Name>.test.tsx,<Name>.stories.tsx. CSS filename and class root must be lowercase. -
Wire into the package per
BUILDING_EDS_2_COMPONENTS.md: export fromnext/index.ts,@importthe CSS innext/index.css. -
Emit an Implementation Status Report per
BUILDING_EDS_2_COMPONENTS.md.
Easy-to-miss reminders (full rationale in the canonical doc):
data-color-appearanceon the smallest element, not the root; elements with it must set acolor/background-colorusing a dynamic token.- For disabled icons: change
data-color-appearancetoneutraland use--eds-color-text-disabled. Neveropacity. data-space-proportionsis calculated from Figma padding, never copied.data-baseline="center"enables text-box-trim so height matches Figma.- Use EXACT
--eds-*tokens fromfigma_get_variable_defs— no hardcoded hex or px. data-font-familyon a flex container setsdisplay: blockand breaks layout.