Imports
Import from the package root, or from a component’s own subpath:
import { Body, Heading } from 'govuk-react';
import * as DateInput from 'govuk-react/date-input';
Components with parts
Components made of several elements export their parts by name, as in Radix Primitives. Import them as a namespace:
import * as Details from 'govuk-react/details';
<Details.Composite summary="Help with nationality">
We need to know your nationality so we can work out which elections you're entitled to vote in.
</Details.Composite>
Each component with parts has a Composite, which renders the whole component from props, as govuk-frontend’s Nunjucks macro does. Compose the parts yourself when you need to pass props to a particular element.
Components made of a single element, such as Heading, Body and Button, are imported by name.