### Install @sumup-oss/icons
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/icons/README.md
Commands to install the package using npm or yarn.
```sh
# With npm
npm install @sumup-oss/icons
# With yarn v1
yarn add @sumup-oss/icons
```
--------------------------------
### Install the package
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/illustrations/README.md
Use npm or yarn to add the package to your project.
```sh
# With npm
npm install @sumup-oss/illustrations
# With yarn
yarn add @sumup-oss/illustrations
```
--------------------------------
### Run the development server
Source: https://github.com/sumup-oss/circuit-ui/blob/main/templates/nextjs/template/README.md
Starts the local development server for the Next.js application.
```bash
npm run dev
```
--------------------------------
### Install peer dependencies
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/introduction/2-getting-started.mdx
Install the required peer dependencies for Circuit UI to function correctly.
```sh
# With npm:
npm install --save @sumup-oss/design-tokens @sumup-oss/icons @sumup-oss/intl react react-dom temporal-polyfill
# With yarn v1
yarn add @sumup-oss/design-tokens @sumup-oss/icons @sumup-oss/intl react react-dom temporal-polyfill
```
--------------------------------
### Install a specific release channel version
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/contributing/4-release-process.mdx
Use this command to install a version from a specific release channel in your project.
```bash
npm install @sumup-oss/circuit-ui@
```
--------------------------------
### Design token migration example
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Example of manual migration for typography design tokens.
```text
typography.text.mega
```
```text
typography.body.one
```
--------------------------------
### Install Peer Dependencies
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/README.md
Install the necessary peer dependencies if they are not already present in your project.
```sh
# With npm
npm install --save react react-dom @sumup-oss/design-tokens @sumup-oss/icons @sumup-oss/intl
# With yarn v1
yarn add react react-dom @sumup-oss/design-tokens @sumup-oss/icons @sumup-oss/intl
```
--------------------------------
### Install Circuit UI
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/README.md
Use these commands to add the library to your project using npm or yarn.
```sh
# With npm
npm install --save @sumup-oss/circuit-ui
# With yarn v1
yarn add @sumup-oss/circuit-ui
```
--------------------------------
### Modal Provider Setup
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/Modal/Modal.mdx
Wrap the application in a ModalProvider to enable the useModal hook.
```tsx
import { ModalProvider } from '@sumup-oss/circuit-ui';
export function App() {
return {/* Your content here... */};
}
```
--------------------------------
### Install core peer dependencies
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Install required React and Emotion peer dependencies for Circuit UI v2.
```sh
# With yarn
yarn add react react-dom @emotion/core @emotion/styled emotion-theming
# With npm
npm install --save react-dom @emotion/core @emotion/styled emotion-theming
```
--------------------------------
### Install the ESLint plugin
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/README.md
Use npm or yarn to add the package as a development dependency.
```sh
# With npm
npm install --save-dev @sumup-oss/eslint-plugin-circuit-ui
# With yarn v1
yarn add --dev @sumup-oss/eslint-plugin-circuit-ui
```
--------------------------------
### Install design tokens package
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/design-tokens/README.md
Use npm or yarn to add the package to your project dependencies.
```sh
# With npm
npm install @sumup-oss/design-tokens
# With yarn v1
yarn add @sumup-oss/design-tokens
```
--------------------------------
### Install Circuit UI package
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/introduction/2-getting-started.mdx
Use npm or yarn to add the Circuit UI package to an existing project.
```sh
# With npm:
npm install @sumup-oss/circuit-ui
# With yarn v1
yarn add @sumup-oss/circuit-ui
```
--------------------------------
### Install extracted package dependencies
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Install the new required peer dependency packages for themes, icons, internationalization, and event tracking.
```sh
# With yarn
yarn add @sumup/collector @sumup/design-tokens @sumup/icons @sumup/intl
# With npm
npm install --save @sumup/collector @sumup/design-tokens @sumup/icons @sumup/intl
```
--------------------------------
### Correct component usage
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-renamed-components/README.md
Example of the updated component import and usage after applying the rule.
```tsx
import { ActionMenu } from '@sumup-oss/circuit-ui/components/ActionMenu';
function Component() {
return ;
}
```
--------------------------------
### Correct usage of props
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-deprecated-props/README.md
This example shows the recommended way to use the component after replacing the deprecated prop.
```tsx
function Component() {
return ;
}
```
--------------------------------
### Incorrect component imports
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/component-lifecycle-imports/README.md
Shows an example of importing components from the experimental entrypoint when they have moved to the stable entrypoint.
```tsx
import { Timestamp } from '@sumup-oss/circuit-ui/experimental';
import type { TimestampProps } from '@sumup-oss/circuit-ui/experimental';
```
--------------------------------
### Use legacy styled component
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Example of a component using the custom styled utility.
```tsx
// components/RedCard.tsx
import { css } from "@emotion/core";
import styled from "util/styled";
const RedCard = styled(Card)(
({ theme }) => css`
background-color: red;
`
);
```
--------------------------------
### Spacing Mixin Usage
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/styles/style-mixins.mdx
Examples of applying spacing to elements.
```tsx
// A single spacing string is applied to all sides
const AllSides = () =>
;
// Specify spacing for individual sides in an object
const IndividualSides = () => (
);
// The `spacing` mixin supports the special values `0` and `auto`,
// this can be useful to horizontally center an element
const HorizontallyCentered = () => (
);
```
--------------------------------
### Typography component size mapping
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Examples of mapping v2 typography component sizes to v3 equivalents.
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
```jsx
```
--------------------------------
### Update Emotion dependencies
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Remove legacy Emotion packages and install the v11 equivalents.
```sh
# example with yarn
yarn remove @emotion/core jest-emotion babel-plugin-emotion # remove legacy dependencies
yarn add @emotion/react # add new dependencies
yarn add -D @emotion/babel-plugin @emotion/jest # add new dev dependencies
yarn upgrade @emotion/styled --latest # upgrade existing packages
```
--------------------------------
### Correct usage of default props
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-default-props/README.md
Examples of code that comply with the rule by omitting redundant props.
```jsx
import { Body, Button, IconButton } from '@sumup-oss/circuit-ui';
Hello;
;
More;
```
--------------------------------
### Structure two-dimensional data with HTML tables
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/List/List.mdx
An example of using an HTML table to display country and capital data for better accessibility.
```html
Country
Capital
Germany
Berlin
Ireland
Dublin
Canada
Ottawa
```
--------------------------------
### Badge to Status rename example
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-renamed-components/README.md
Demonstrates the transformation of the Badge component to the Status component.
```tsx
import { Badge } from '@sumup-oss/circuit-ui';
function Component() {
return 1;
}
```
```tsx
import { Status } from '@sumup-oss/circuit-ui';
function Component() {
return 1;
}
```
--------------------------------
### Structure two-dimensional data with HTML lists
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/List/List.mdx
An example of using a standard unordered list to display country and capital data.
```html
Germany (Capital: Berlin)
Ireland (Capital: Dublin)
Canada (Capital: Ottawa)
```
--------------------------------
### Correct usage of updated custom properties
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-deprecated-custom-properties/README.md
This example shows the compliant version of the CSS code using the current design tokens.
```css
.class {
font-size: var(--cui-typography-headline-l-font-size);
line-height: var(--cui-typography-headline-l-line-height);
}
```
--------------------------------
### SVG Icon Implementation
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/icons/CONTRIBUTING.md
Example of an SVG icon structure, noting that brand icons should use specific fill colors rather than currentColor.
```svg
```
--------------------------------
### Correct usage of icons
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-deprecated-icons/README.md
Example of code that complies with the rule by using a valid, non-deprecated icon.
```tsx
import { FlagFr } from '@sumup-oss/icons';
function Component() {
return
}
```
--------------------------------
### Define a metadata description list
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/List/List.mdx
A simple example of a description list containing two metadata label-value pairs.
```html
Account number
12345
Sign-up date
21.12.2021
```
--------------------------------
### Correct usage of custom properties
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-invalid-custom-properties/README.md
Example of a valid CSS custom property usage that complies with the rule.
```css
color: var(--cui-bg-normal);
```
--------------------------------
### Correct usage of renamed props
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-renamed-props/README.md
Examples of code that comply with the current Circuit UI prop naming conventions.
```tsx
// Since Circuit UI v9
function Component() {
return (
);
}
// Since Circuit UI v7.5
function Component() {
return (
Add to card
);
}
// Badge → Status
function Component() {
return (
1
);
}
```
--------------------------------
### Update package dependencies
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Uninstall old @sumup packages and install the new @sumup-oss scoped packages along with required peer dependencies.
```sh
npm uninstall @sumup/circuit-ui @sumup/design-tokens @sumup/icons @sumup/intl
npm install @sumup-oss/circuit-ui @sumup-oss/design-tokens @sumup-oss/icons @sumup-oss/intl temporal-polyfill
```
--------------------------------
### Initialize a new project
Source: https://github.com/sumup-oss/circuit-ui/blob/main/templates/astro/README.md
Use this command to scaffold a new Astro project using the Circuit UI template.
```bash
npx create-astro@latest ./my-app --template sumup-oss/circuit-ui/templates/astro
```
--------------------------------
### Run Circuit UI Migration CLI
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Displays the help menu and available options for the migration CLI tool.
```sh
yarn circuit-ui migrate
Automatically transforms your source code to Circuit UI's latest APIs
Options:
--language, -l The programming language(s) of the files to be transformed
[array] [required] [choices: "TypeScript", "JavaScript", "Flow"]
--path, -p A path to the folder that contains the files to be
transformed [string] [default: "."]
--transform, -t The transform to be applied to the source code
[string] [required] [choices: "button-variant-enum", ...]
```
--------------------------------
### Enter prerelease mode
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/contributing/4-release-process.mdx
Commands to switch to a release branch and initialize prerelease mode using changesets.
```bash
git checkout next # or `canary`
npx changeset pre enter next # or `canary`
```
--------------------------------
### Build the icons package
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/icons/CONTRIBUTING.md
Build the icons package using lerna.
```bash
npx lerna run build --scope=@sumup-oss/icons
```
--------------------------------
### Configure the plugin
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/stylelint-plugin-circuit-ui/README.md
Add the plugin to your Stylelint configuration file.
```json
{
"plugins": ["@sumup-oss/stylelint-plugin-circuit-ui"]
}
```
--------------------------------
### Incorrect component usage
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-renamed-components/README.md
Example of an outdated component import and usage that triggers the rule.
```tsx
import { Popover } from '@sumup-oss/circuit-ui';
function Component() {
return ;
}
```
--------------------------------
### Upgrade dependencies
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Run this command to update the core library and design tokens to the latest version.
```sh
npm upgrade @sumup/circuit-ui @sumup/design-tokens @sumup/icons
```
--------------------------------
### Initialize ToastProvider
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/NotificationToast/NotificationToast.mdx
Wrap the application in ToastProvider to manage toast state and ensure accessibility.
```tsx
// _app.tsx for Next.js or App.js for CRA
import { ToastProvider } from '@sumup-oss/circuit-ui';
export default function App() {
return {/* Your content goes here... */};
}
```
--------------------------------
### Implement NotificationBanner with images
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/NotificationBanner/NotificationBanner.mdx
Demonstrates how to use the image prop with either a built-in illustration or a source URL.
```tsx
import { NotificationBanner, type NotificationBannerProps } from '@sumup-oss/circuit-ui';
// with a circuit-ui illustration
function Banner(props: NotificationBannerProps) {
return (
)
}
// with a source URL
function Banner(props: NotificationBannerProps) {
return (
)
}
```
--------------------------------
### Incorrect usage of Emotion.js theme
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/prefer-custom-properties/README.md
Examples of code that will be flagged by the rule for using the theme object directly.
```tsx
const styles = (theme) => css`
padding: ${theme.spacings.kilo};
`;
const Box = styled.div`
padding: ${(theme) => theme.spacings.kilo};
`;
function Component() {
const theme = useTheme();
return ;
}
```
--------------------------------
### Run linting and formatting
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/contributing/3-testing.mdx
Commands to check for linting issues or automatically apply fixes.
```bash
npm run lint
# Automatically fix (some) issues
npm run lint:fix
```
--------------------------------
### Incorrect usage of custom properties
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-invalid-custom-properties/README.md
Example of an invalid CSS custom property usage that will trigger the rule.
```css
color: var(--cui-invalid-property);
```
--------------------------------
### Sort the icons manifest file
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/icons/CONTRIBUTING.md
Use jq to sort the icons manifest file by category, name, and size.
```bash
jq '.icons|=sort_by(.category,.name,-(.size|tonumber))' packages/icons/manifest.json > tmp.json && mv tmp.json packages/icons/manifest.json
```
--------------------------------
### Apply standard naming conventions for components and props
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/contributing/2-code-conventions.mdx
Use standard component names and concise prop names, ensuring event handlers follow the 'onVerb' or 'onVerbNoun' pattern.
```tsx
// Do: Use standard component names and short prop names
// Don't: Come up with unusual component names or name handlers without the `on` prefix
```
--------------------------------
### Incorrect usage of deprecated props
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-deprecated-props/README.md
This example shows a component using a deprecated prop that will be flagged by the rule.
```tsx
function Component() {
return ;
}
```
--------------------------------
### Configure rules
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/stylelint-plugin-circuit-ui/README.md
Enable specific rules under the rules section of your configuration.
```json
{
"rules": {
"circuit-ui/": true
}
}
```
--------------------------------
### Configure custom image width
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/NotificationBanner/NotificationBanner.mdx
Shows how to set a custom width for an image source.
```tsx
import { NotificationBanner, type NotificationBannerProps } from '@sumup-oss/circuit-ui';
function Banner(props: NotificationBannerProps) {
return (
)
}
```
--------------------------------
### Extend Jest matchers for aria-disabled
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Custom Jest setup to support the new aria-disabled attribute in tests.
```js
// jest.setup.js
import { toBeDisabled, toBeEnabled } from "@testing-library/jest-dom/matchers";
function isAriaDisabled(element) {
return (
element.hasAttribute("aria-disabled") &&
element.getAttribute("aria-disabled") === "true"
);
}
expect.extend({
toBeDisabled(element) {
const isDisabled =
toBeDisabled.bind(this)(element).pass || isAriaDisabled(element);
return {
pass: isDisabled,
message: () => {
const is = isDisabled ? "is" : "is not";
return [
this.utils.matcherHint(
`${this.isNot ? ".not" : ""}.toBeDisabled`,
"element",
""
),
"",
`Received element ${is} disabled:`,
` ${this.utils.printReceived(element.cloneNode(false))}`,
].join("\n");
},
};
},
toBeEnabled(element) {
const isEnabled =
toBeEnabled.bind(this)(element).pass || !isAriaDisabled(element);
return {
pass: isEnabled,
message: () => {
const is = isEnabled ? "is" : "is not";
return [
this.utils.matcherHint(
`${this.isNot ? ".not" : ""}.toBeEnabled`,
"element",
""
),
"",
`Received element ${is} enabled:`,
` ${this.utils.printReceived(element.cloneNode(false))}`,
].join("\n");
},
};
},
});
```
--------------------------------
### Run unit tests
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/contributing/3-testing.mdx
Executes the unit test suite in watch mode.
```bash
npm run test
```
--------------------------------
### Configure custom styled utility
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Legacy approach for typing the theme using CreateStyled.
```ts
// utils/styled.ts
import styled, { CreateStyled } from "@emotion/styled";
import { Theme } from "@sumup/design-tokens";
export default styled as CreateStyled;
```
--------------------------------
### Incorrect usage of deprecated icons
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-deprecated-icons/README.md
Example of code that triggers the no-deprecated-icons rule due to the use of an obsolete icon.
```tsx
import { Add } from '@sumup-oss/icons'
function Component() {
return ;
}
```
--------------------------------
### Currency Selection
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/CurrencyInput/CurrencyInput.mdx
Demonstrates how to use the currency prop to define the input's currency type.
```jsx
```
--------------------------------
### Incorrect usage of renamed props
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-renamed-props/README.md
Examples of code that trigger the no-renamed-props rule due to the use of deprecated prop names or values.
```tsx
// Since Circuit UI v9
function Component() {
return (
);
}
// Since Circuit UI v7.5
function Component() {
return (
);
}
// Badge → Status
function Component() {
return (
1
);
}
```
--------------------------------
### Configure the ESLint plugin
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/README.md
Add the plugin to your ESLint configuration file.
```json
{
"plugins": ["@sumup-oss/circuit-ui"]
}
```
--------------------------------
### Migrate color tokens
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Replace legacy theme color references with semantic CSS variables.
```diff
-color: ${theme.colors.p500};
+color: var(--cui-fg-accent);
```
--------------------------------
### Incorrect usage of default props
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-default-props/README.md
Examples of code that will be flagged by the rule because the props provided match the component's default values.
```jsx
import { Body, Button, IconButton } from '@sumup-oss/circuit-ui';
Hello;
;
More
;
```
--------------------------------
### ActionMenu with offset
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/ActionMenu/ActionMenu.mdx
Demonstrates how to position the ActionMenu with an offset.
```jsx
```
--------------------------------
### Implement a list of UI components
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/List/List.mdx
Use a standard unordered list with role="list" and list-style: none to render complex UI elements like cards while maintaining accessibility.
```jsx
function ArticleList(articles) {
return (
{articles.map((article, i) => (
))}
);
}
```
--------------------------------
### Correct component imports
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/component-lifecycle-imports/README.md
Shows the corrected import paths for components that have moved to the stable entrypoint.
```tsx
import { Timestamp } from '@sumup-oss/circuit-ui';
import type { TimestampProps } from '@sumup-oss/circuit-ui';
```
--------------------------------
### Incorrect usage of deprecated custom properties
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/no-deprecated-custom-properties/README.md
This example shows CSS code that triggers the rule due to the use of outdated typography custom properties.
```css
.class {
font-size: var(--cui-typography-headline-one-font-size);
line-height: var(--cui-typography-headline-one-line-height);
}
```
--------------------------------
### Correct usage of CSS custom properties
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/prefer-custom-properties/README.md
Examples of code using CSS custom properties, which are not flagged by the rule. Note that media queries are excluded from this rule.
```tsx
const styles = () => css`
padding: var(--cui-spacings-kilo);
`;
const Box = styled.div`
padding: var(--cui-spacings-kilo);
`;
function Component() {
return ;
}
// CSS custom properties aren't supported inside media queries,
// so the rule doesn't flag or replace `theme.mq.*` tokens.
const mediaQueries = (theme) => css`
${theme.mq.kilo} {
display: flex;
}
`;
```
--------------------------------
### Implement tab-like navigation
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/Tabs/Tabs.mdx
Configure TabList and Tab components to render as navigation elements instead of standard tab semantics.
```tsx
HomeAboutContact
```
--------------------------------
### useFocusList()
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/hooks/useFocusList/useFocusList.mdx
The useFocusList hook returns props that should be spread onto the container element of your list to enable keyboard navigation.
```APIDOC
## useFocusList()
### Description
Enables keyboard navigation for a list of focusable elements using arrow keys.
### Signature
```ts
function useFocusList(): {
'data-focus-list': string;
'onKeyDown': (event: KeyboardEvent) => void;
};
```
### Returns
- **data-focus-list** (string) - An attribute used to identify the list container.
- **onKeyDown** (function) - A keyboard event handler to be attached to the list container to manage focus navigation.
```
--------------------------------
### useMedia(query: string, initialState = false): boolean
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/hooks/useMedia/useMedia.mdx
Tracks the state of a media query and returns a boolean indicating if the query matches.
```APIDOC
## useMedia(query, initialState)
### Description
Tracks the state of a CSS media query. Returns true if the media query matches, otherwise false.
### Signature
`function useMedia(query: string, initialState?: boolean): boolean`
### Parameters
- **query** (string) - Required - The CSS media query string to track.
- **initialState** (boolean) - Optional - The default value to return during server-side rendering or before the media query is evaluated. Defaults to `false`.
### Returns
- **boolean** - Returns `true` if the media query matches the current environment, otherwise `false`.
```
--------------------------------
### Importing Experimental Components
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/introduction/3-component-lifecycle.mdx
Experimental components are imported from the experimental sub-package.
```tsx
import { Component } from '@sumup-oss/circuit-ui/experimental';
```
--------------------------------
### Import styles
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/illustrations/README.md
Include the package styles in your application.
```tsx
import '@sumup-oss/illustration/styles.css';
```
--------------------------------
### Apply media queries using the theme
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/features/1-theme.mdx
Use the theme's media query helpers within Emotion CSS blocks.
```ts
import { css } from '@emotion/react';
const styles = ({ theme }) => css`
${theme.mq.mega} {
padding-top: ${theme.spacings.peta};
}
`;
```
--------------------------------
### Tooltip implementation
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/Tooltip/Tooltip.mdx
Displays the base Tooltip component and its associated properties.
```jsx
```
--------------------------------
### Apply Style Mixins
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/styles/style-mixins.mdx
Demonstrates using style mixins directly with the css prop or within styled components.
```tsx
import { clearfix, spacing } from '@sumup-oss/circuit-ui/legacy';
import styled from '@emotion/styled';
import { css } from '@emotion/react';
// Pass the style mixin directly to the `css` prop
const Basic = () => ;
// Some style mixins accept options
const Options = () => ;
// Style mixins can also be used in a style function...
const someStyles = ({ theme }) => css`
&:focus {
${focusOutline()};
}
`;
// ...or passed to a styled component directly
const StyledComponent = styled.div(someStyles, clearfix);
```
--------------------------------
### Project directory structure
Source: https://github.com/sumup-oss/circuit-ui/blob/main/templates/astro/README.md
Visual representation of the standard file layout for the Astro project.
```text
/
├── public/
├── src/
│ └── pages/
│ └── index.astro
└── package.json
```
--------------------------------
### Import styles and theme
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/introduction/2-getting-started.mdx
Import fonts and design tokens before the component styles to ensure the theme is correctly applied.
```tsx
// /app/layout.tsx or /pages/_app.tsx for Next.js
import '@sumup-oss/design-tokens/fonts.css';
import '@sumup-oss/design-tokens/light.css';
import '@sumup-oss/circuit-ui/styles.css';
```
--------------------------------
### Render Table with Component Rows
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/Table/Table.mdx
Demonstrates how to pass objects instead of strings as children to table headers and rows.
```jsx
```
--------------------------------
### NotificationInline with headline and action
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/NotificationInline/NotificationInline.mdx
Demonstrates adding an optional headline and action button to the notification.
```jsx
```
--------------------------------
### Timestamp Format Styles
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/Timestamp/Timestamp.mdx
Demonstrates the use of formatStyles and includeTime props to control verbosity and time display.
```jsx
```
--------------------------------
### Run development with accessibility errors disabled
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Temporarily bypass runtime accessibility errors in development by setting the environment variable.
```sh
UNSAFE_DISABLE_ACCESSIBILITY_ERRORS=true yarn dev # or yarn start
```
--------------------------------
### Access legacy breakpoint and media query theme properties
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/features/1-theme.mdx
Access breakpoint and media query definitions within the legacy JS theme.
```text
theme.mq.[untilKilo|kilo|kiloToMega|mega|untilMega|megaToGiga|giga|gigaToTera|tera]
theme.breakpoints.[untilKilo|kilo|kiloToMega|mega|untilMega|megaToGiga|giga|gigaToTera|tera]
```
--------------------------------
### Importing Legacy Components
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/introduction/3-component-lifecycle.mdx
Legacy components are imported from the legacy sub-package.
```tsx
import { Component } from '@sumup-oss/circuit-ui/legacy';
```
--------------------------------
### Configure ESLint rules
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/eslint-plugin-circuit-ui/README.md
Enable specific rules under the rules section of your configuration.
```json
{
"rules": {
"@sumup-oss/circuit-ui/": "error"
}
}
```
--------------------------------
### Import Icon as React Component
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/icons/README.md
Basic usage of an icon imported as a React component.
```tsx
import { Check } from '@sumup-oss/icons';
const SuccessMessage = ({ description }) => (
{description}
);
```
--------------------------------
### Upgrade Circuit UI dependencies
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Command to update the library and its peer dependencies to the latest version.
```sh
npm upgrade @sumup-oss/circuit-ui @sumup-oss/design-tokens @sumup-oss/icons @sumup-oss/stylelint-plugin-circuit-ui @sumup-oss/eslint-plugin-circuit-ui
```
--------------------------------
### Upgrade Circuit UI dependencies
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Command to update the core library and its required peer dependencies to the latest versions.
```sh
npm upgrade @sumup-oss/circuit-ui @sumup-oss/design-tokens @sumup-oss/icons
```
--------------------------------
### Configure ModalProvider
Source: https://github.com/sumup-oss/circuit-ui/blob/main/skills/circuit-ui/references/components/NotificationModal.mdx
Wrap your application in the ModalProvider to enable the useNotificationModal hook.
```tsx
import { ModalProvider } from "@sumup-oss/circuit-ui";
export default function App() {
return {/* Your content here... */};
}
```
--------------------------------
### Construct URL manually
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/illustrations/README.md
Directly reference the CDN URL for CSS background images.
```css
.illustration {
background-image: url('https://circuit.sumup.com/illustrations/bookings_dark.svg');
}
```
--------------------------------
### Load Icon from CDN URL
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/icons/README.md
Use the getIconURL helper or manual URL construction to load icons from the CDN.
```tsx
import { getIconURL } from '@sumup-oss/icons';
const SuccessMessage = ({ message }) => (
{message}
);
```
```css
.icon {
background-image: url('https://circuit.sumup.com/icons/v2/check_24.svg');
}
```
--------------------------------
### Migrate design tokens to CSS custom properties
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Replace JavaScript theme object properties with CSS custom properties.
```diff
-${theme.borderRadius.circle}
+var(--cui-border-radius.circle)
```
--------------------------------
### Configure Babel for new JSX transform
Source: https://github.com/sumup-oss/circuit-ui/blob/main/MIGRATION.md
Recommended Babel configuration for Next.js and Emotion 10 compatibility.
```json
{
"presets": [
[
"next/babel",
{
"preset-react": {
"runtime": "automatic",
"importSource": "@emotion/core"
}
}
]
],
"plugins": [["babel-plugin-emotion", { "cssPropOptimization": true }]]
}
```
--------------------------------
### Load illustration from a URL
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/illustrations/README.md
Use the getIllustrationURL helper for type-safe access to hosted SVG files.
```tsx
import { getIllustrationURL } from '@sumup-oss/illustrations';
const SuccessScreen = ({ message }) => (
Payment failed. Please contact your card provider.
);
```
--------------------------------
### Render a Tag with prefix or suffix
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/Tag/Tag.mdx
Displays the Tag component with additional content as a prefix or suffix.
```jsx
```
--------------------------------
### Render ImageInput with custom components
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/ImageInput/ImageInput.mdx
Demonstrates using custom img or div elements as the visual component for the ImageInput.
```jsx
```
```jsx
```
--------------------------------
### Preload font files
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/design-tokens/README.md
Add preload links to the document head to optimize font loading performance.
```html
```
--------------------------------
### AutocompleteInput with AllowNewItems
Source: https://github.com/sumup-oss/circuit-ui/blob/main/packages/circuit-ui/components/AutocompleteInput/AutocompleteInput.mdx
Enables the selection of user-provided input as a valid option.
```jsx
```
--------------------------------
### Override base components with ComponentsContext
Source: https://github.com/sumup-oss/circuit-ui/blob/main/docs/features/3-components.mdx
Use the ComponentsContext.Provider to inject custom implementations for base components like Link. Circuit UI merges these with defaults, allowing partial overrides.
```javascript
import { Link } from 'react-router-dom';
import { ComponentsContext, Button } from '@sumup-oss/circuit-ui';
const CustomLink = ({ to, ...props }) => ;
const App = () => (
);
export default App;
```