1---2name: grommet-component-contribution3description: Build and contribute Grommet React components following official team conventions. Use when creating a new component from scratch, refactoring a component to align with Grommet conventions, preparing a PR for Grommet core contribution, or reviewing a component against acceptance criteria. Covers scaffolding, forwardRef, displayName, useThemeValue, FormContext, propTypes, TypeScript declarations, accessibility, i18n, and testing.4---56# Grommet Component Contribution Skill78## Use When9- Building a new Grommet component from scratch10- Refactoring a component to align with Grommet conventions11- Preparing a PR for Grommet core contribution12- Reviewing a component against the Grommet acceptance criteria1314## Workflow151. Discover: read the closest existing component, its tests, propTypes, types, and stories.162. Plan: define the value contract, commit model, minimum props, and composition boundaries.173. Scaffold: create the component files, register exports, and add docs/tests/stories.184. Implement: build pure utilities first, then the component with `forwardRef`, `useForwardedRef`, `useThemeValue`, and `FormContext` integration.195. Test: start with accessibility, then value emission, form integration, keyboard, and edge cases.206. Stories: controlled usage, `FormField` integration, and `CustomThemed` only if new theme tokens exist.217. Validate: lint, full tests, and top-level `grommet` export coverage.2223## Non-Negotiable Principles24- Compose small primitives before building a monolith.25- Prefer native browser APIs such as `Intl` over custom format/parse logic.26- Put customization in theme tokens, not instance props.27- Keep accessibility, semantic HTML, and keyboard support mandatory.28- Use `onChange` with the `{ value }` shape for structured inputs.29 - Native element wrappers (TextInput, CheckBox) emit the standard React synthetic event via `onChange(event)`.30 - Structured inputs that own a parsed/formatted value (DateInput) emit `onChange({ value })`.31- Simple inputs emit on every meaningful interaction; structured inputs emit only when the composed value is valid.32- Spread `...rest` onto the root DOM element, though some components may be selective about placement.3334## Default API Shape35- Start with only truly universal props: `aria-label`, `id`, and `...rest`.36- Apply `disabled` only to value-input components (TextInput, CheckBox, Select, DateInput, etc.).37- Do NOT add `disabled` to non-interactive display components (Text, Heading, Anchor).38- Use `genericProps` for layout and style passthrough.39- See [REFERENCE.md](./REFERENCE.md) for component-specific API shapes.4041## Implementation Checklist42- `React.forwardRef` plus `displayName`43- `useForwardedRef(refArg)` instead of raw refs44- `const { theme, passThemeFlag } = useThemeValue()`45- `FormContext` integration via `useFormInput` when the component participates in forms46- TypeScript declarations in `index.d.ts`47- `propTypes.js` guarded for production48- Component barrel export and top-level export registration49- Theme defaults live under a dedicated `theme.<componentName>` namespace50- Stories in CSF-3 format51- Tests use `@testing-library/user-event`, `jest-axe`, and `<Grommet>` wrappers5253## When Unsure541. Check the nearest similar component.552. Check existing theme tokens.563. Check shared utilities or `FormContext`.574. Ask before inventing a new pattern.585. Read [REFERENCE.md](./REFERENCE.md) before making implementation decisions.596. Review [EXAMPLES.md](./EXAMPLES.md) for a matching archetype before drafting new APIs.6061## Detailed Reference62- [REFERENCE.md](./REFERENCE.md) — anti-hallucination rules, implementation patterns, PR checklist, decision tree, and anti-patterns63- [EXAMPLES.md](./EXAMPLES.md) — archetype code examples for all 4 component types (Simple Input, Drop/Modal, Display Only, Layout)64- [references/architecture.md](./references/architecture.md) — forwardRef, useForwardedRef, useThemeValue, FormContext/useFormInput, directory structure, propTypes, TypeScript declarations65- [references/styling.md](./references/styling.md) — styled-components, styledComponentsConfig, theme token namespace, disabledStyle/readOnlyStyle, t-shirt sizing66- [references/accessibility.md](./references/accessibility.md) — Keyboard component, focus restore, aria-label, Escape handling, semantic HTML rules67- [references/forms.md](./references/forms.md) — FormContext.useFormInput(), FormField error surfacing, non-destructive UX68- [references/i18n.md](./references/i18n.md) — MessageContext string keys, AnnounceContext live regions, polite vs assertive