Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions docs/configuration/javascript-api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Some of our components can be passed JavaScript configuration objects. You can d

This page lists the options available for the following components:

- [Accordion](#accordion)
- [Button](#button)
- [CharacterCount](#charactercount)
- [Checkboxes](#checkboxes)
Expand All @@ -19,6 +20,99 @@ This page lists the options available for the following components:
- [SkipLink](#skiplink)
- [Tabs](#tabs)

## Accordion

### i18n

Type: object

Messages the component uses for the labels of its buttons. This includes the
visible text shown on screen, and text to help assistive technology users for
the buttons toggling each section.

Default: see properties

#### Properties

##### hideAllSections

Type: string

The text content for the 'Hide all sections' button, used when at least one
section is expanded.

Default:

```json5
'Hide all sections'
```

##### hideSection

Type: string

The text content for the 'Hide' button, used when a section is expanded.

Default:

```json5
'Hide'
```

##### hideSectionAriaLabel

Type: string

The text content appended to the 'Hide' button's accessible name when a section is expanded.

Default:

```json5
'Hide this section'
```

##### showAllSections

Type: string

The text content for the 'Show all sections' button, used when all sections are collapsed.

Default:

```json5
'Show all sections'
```

##### showSection

Type: string

The text content for the 'Show' button, used when a section is collapsed.

Default:

```json5
'Show'
```

##### showSectionAriaLabel

Type: string

The text content appended to the 'Show' button's accessible name when a section is expanded.

Default:

```json5
'Show this section'
```

### rememberExpanded

Type: boolean

Whether the expanded and collapsed state of each section is remembered and restored when navigating

## Button

### preventDoubleClick
Expand Down
5 changes: 4 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ export default defineConfig([
// JSDoc @returns is optional
'jsdoc/require-returns-description': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/require-returns': 'off'
'jsdoc/require-returns': 'off',

// Allow optional catch binding
'no-empty': ['error', { allowEmptyCatch: true }]
}
},
{
Expand Down
1 change: 1 addition & 0 deletions packages/nhsuk-frontend/src/nhsuk/components/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
@forward "password-input";

// Content presentation
@forward "accordion";
@forward "details";
@forward "do-dont-list";
@forward "hero";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Action link

## Installation

See the [main README quick start guide](https://github.com/nhsuk/nhsuk-frontend#quick-start) for how to install this component.

## Guidance and examples

To learn more about the accordion component and when to use it, visit the [design system in the NHS digital service manual](https://service-manual.nhs.uk/design-system/components/accordion) for guidance, examples and options.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@forward ".";
Loading