diff --git a/src/components/navigation/action-link/README.md b/src/components/navigation/action-link/README.md
index 0550c327b..2d434cc73 100644
--- a/src/components/navigation/action-link/README.md
+++ b/src/components/navigation/action-link/README.md
@@ -2,7 +2,7 @@
This component can be found in the `nhsuk-frontend` repository [here](https://github.com/nhsuk/nhsuk-frontend/tree/main/packages/nhsuk-frontend/src/nhsuk/components/action-link).
-## Implementation Notes
+## Implementation notes
The ActionLink component does not use the `nhsuk-frontend` "openInNewWindow" property, instead it allows the user to add the `target="_blank"` property (if desired).
diff --git a/stories/Content Presentation/Details.stories.tsx b/stories/Content Presentation/Details.stories.tsx
index 4b4741637..2c9a1606e 100644
--- a/stories/Content Presentation/Details.stories.tsx
+++ b/stories/Content Presentation/Details.stories.tsx
@@ -4,43 +4,13 @@ import { Details } from '#components';
/**
* This component can be found in the `nhsuk-frontend` repository here.
*
- * ## Implementation Notes
+ * ## Implementation notes
*
* The `Details` component has three subcomponents:
*
* - `Details.Summary`
* - `Details.Text`
* - `Details.ExpanderGroup`
- *
- * ## Usage
- *
- * ### Standard
- *
- * ```jsx
- * import { Details } from "nhsuk-react-components";
- *
- * const Element = () => {
- * return (
- *
- * Where can I find my NHS number?
- *
- *
An NHS number is a 10 digit number, like 485 777 3456.
- *
- * You can find your NHS number on any document sent to you by the NHS. This may include:
- *
- *
- *
prescriptions
- *
test results
- *
hospital referral letters
- *
appointment letters
- *
your NHS medical card
- *
- *
Ask your GP practice for help if you can't find your NHS number.
- *
- *
- * );
- * }
- * ```
*/
const meta: Meta = {
title: 'Content Presentation/Details',
diff --git a/stories/Content Presentation/DoAndDontList.stories.tsx b/stories/Content Presentation/DoAndDontList.stories.tsx
index a72d912f8..0089f79c1 100644
--- a/stories/Content Presentation/DoAndDontList.stories.tsx
+++ b/stories/Content Presentation/DoAndDontList.stories.tsx
@@ -4,38 +4,15 @@ import { DoAndDontList } from '#components';
/**
* This component can be found in the `nhsuk-frontend` repository here.
*
- * ## Implementation Notes
+ * ## Implementation notes
*
* The `DoAndDontList` component has one subcomponent: `DoAndDontList.Item`.
*
* As long as a `listType` is supplied to the `DoAndDontList` component, all subcomponents will render as desired. If you require a `DoAndDontList.Item` to be different, a `listItemType` prop can be supplied to force the type.
*
- *
* The `DoAndDontList.Item` component can also accept a `prefixText` prop, which can be used to override the default prefix text.
*
* See the custom prefix text story for an example.
- *
- * ## Usage
- *
- * ### Standard
- *
- * ```jsx
- * import { DoAndDontList } from "nhsuk-react-components";
- *
- * const Element = () => {
- * return (
- *
- *
- * cover blisters that are likely to burst with a soft plaster or dressing
- *
- * wash your hands before touching a burst blister
- *
- * allow the fluid in a burst blister to drain before covering it with a plaster or dressing
- *
- *
- * );
- * }
- * ```
*/
const meta: Meta = {
title: 'Content Presentation/DoAndDontList',
@@ -45,8 +22,11 @@ export default meta;
type Story = StoryObj;
export const Do: Story = {
+ args: {
+ listType: 'do',
+ },
render: (args) => (
-
+
cover blisters that are likely to burst with a soft plaster or dressing
@@ -59,8 +39,11 @@ export const Do: Story = {
};
export const Dont: Story = {
+ args: {
+ listType: 'dont',
+ },
render: (args) => (
-
+ burst a blister yourselfpeel the skin off a burst blisterpick at the edges of the remaining skin
@@ -90,8 +73,11 @@ export const Dont: Story = {
* | JSX | The JSX will be rendered, such as `` |
*/
export const CustomPrefixText: Story = {
- render: () => (
-
+ args: {
+ listType: 'dont',
+ },
+ render: (args) => (
+ burst a blister yourself
peel the skin off a burst blister
diff --git a/stories/Content Presentation/NotificationBanner.stories.tsx b/stories/Content Presentation/NotificationBanner.stories.tsx
index d247ba9df..d5d4bae25 100644
--- a/stories/Content Presentation/NotificationBanner.stories.tsx
+++ b/stories/Content Presentation/NotificationBanner.stories.tsx
@@ -5,32 +5,13 @@ import { NotificationBannerLink } from '#components/content-presentation/notific
/**
* This component can be found in the `nhsuk-frontend` repository here.
*
- * ## Implementation Notes
+ * ## Implementation notes
*
* The `NotificationBanner` component has three subcomponents:
*
* - `NotificationBanner.Title`
* - `NotificationBanner.Heading`
* - `NotificationBanner.Link`
- *
- * ## Usage
- *
- * ### Standard
- *
- * ```jsx
- * import { NotificationBanner } from "nhsuk-react-components";
- *
- * const Element = () => {
- * return (
- *
- * Patient record updated
- *
- * Contact example@department.nhs.uk if you think there's a problem.
- *
- *
- * );
- * }
- * ```
*/
const meta: Meta = {
title: 'Content Presentation/Notification Banner',
@@ -41,8 +22,8 @@ type Story = StoryObj;
export const StandardPanel: Story = {
args: {},
- render: () => (
-
+ render: (args) => (
+
The service will be unavailable from 8pm to 9pm on Thursday 1 January 2025.
@@ -51,9 +32,11 @@ export const StandardPanel: Story = {
};
export const SuccessPanel: Story = {
- args: {},
- render: () => (
-
+ args: {
+ success: true,
+ },
+ render: (args) => (
+ Patient record updated
Contact{' '}
@@ -66,8 +49,8 @@ export const SuccessPanel: Story = {
export const StandardPanelWithLink: Story = {
args: {},
- render: () => (
-
+ render: (args) => (
+
You have 7 days left to send your application.{' '}
View application.
@@ -80,8 +63,8 @@ export const StandardPanelWithCustomTitle: Story = {
args: {
title: 'Important Message',
},
- render: () => (
-
+ render: (args) => (
+ Upcoming maintenance
The service will be unavailable from 8pm to 9pm on Thursday 1 January 2025.
@@ -126,8 +109,8 @@ export const StandardPanelWithList: Story = {
export const StandardPanelWithLotsOfContent: Story = {
args: {},
- render: () => (
-
+ render: (args) => (
+
Check if you need to apply the reverse charge to this application
diff --git a/stories/Content Presentation/Panel.stories.tsx b/stories/Content Presentation/Panel.stories.tsx
index d8f289cd7..2e5199472 100644
--- a/stories/Content Presentation/Panel.stories.tsx
+++ b/stories/Content Presentation/Panel.stories.tsx
@@ -9,8 +9,8 @@ export default meta;
type Story = StoryObj;
export const StandardPanel: Story = {
- render: () => (
-
+ render: (args) => (
+ Booking complete
We have sent you a confirmation email
@@ -18,8 +18,8 @@ export const StandardPanel: Story = {
};
export const PanelWithCustomHeadingLevel: Story = {
- render: () => (
-
+ render: (args) => (
+ Booking complete
We have sent you a confirmation email
diff --git a/stories/Content Presentation/Tabs.stories.tsx b/stories/Content Presentation/Tabs.stories.tsx
index 9f91fbbb0..01a66a613 100644
--- a/stories/Content Presentation/Tabs.stories.tsx
+++ b/stories/Content Presentation/Tabs.stories.tsx
@@ -18,8 +18,8 @@ export default meta;
type Story = StoryObj;
export const Standard: Story = {
- render: () => (
-
+ render: (args) => (
+ ContentsPast day
@@ -48,8 +48,8 @@ export const Standard: Story = {
* It also displays if the user has JavaScript disabled.
*/
export const DifferentAccessibleHeading: Story = {
- render: () => (
-
+ render: (args) => (
+ Tabs titlePast day
diff --git a/stories/Content Presentation/Tag.stories.tsx b/stories/Content Presentation/Tag.stories.tsx
index cbd3a0eca..2bf3cef5c 100644
--- a/stories/Content Presentation/Tag.stories.tsx
+++ b/stories/Content Presentation/Tag.stories.tsx
@@ -11,7 +11,7 @@ type Story = StoryObj;
export const StandardTag: Story = { args: { children: 'Standard' } };
export const AllColours: Story = {
- render: (args) => (
+ render: () => (
StartedNot started
diff --git a/stories/Content Presentation/WarningCallout.stories.tsx b/stories/Content Presentation/WarningCallout.stories.tsx
index 97913c621..2f4210df5 100644
--- a/stories/Content Presentation/WarningCallout.stories.tsx
+++ b/stories/Content Presentation/WarningCallout.stories.tsx
@@ -10,7 +10,7 @@ type Story = StoryObj;
export const StandardWarningCallout: Story = {
render: (args) => (
-
+ Important
For safety, tell your doctor or pharmacist if you're taking any other medicines,
@@ -24,7 +24,7 @@ export const StandardWarningCallout: Story = {
export const WarningCalloutWithCustomHeading: Story = {
render: (args) => (
-
+ School, nursery or work
Stay away from school, nursery or work until all the spots have crusted over. This is
@@ -36,7 +36,7 @@ export const WarningCalloutWithCustomHeading: Story = {
export const WarningCalloutWithCustomHeadingLevel: Story = {
render: (args) => (
-
+ School, nursery or work
Stay away from school, nursery or work until all the spots have crusted over. This is
diff --git a/stories/Form Elements/Button.stories.tsx b/stories/Form Elements/Button.stories.tsx
index caaa98f3f..0e6c64ca4 100644
--- a/stories/Form Elements/Button.stories.tsx
+++ b/stories/Form Elements/Button.stories.tsx
@@ -4,7 +4,7 @@ import { Button } from '#components';
/**
* This component can be found in the `nhsuk-frontend` repository here.
*
- * ## Implementation Notes
+ * ## Implementation notes
*
* The `Button` component from `nhsuk-react-components` will either render a standard `
} value="mines">
- Waste from mines or quarries
-
-
-
- ),
-};
-
-export const WithLegendAsPageHeading: Story = {
- render: (args) => (
-
+
+ This includes rocks and earth.
} value="mines">
+ Waste from mines or quarries
+
+
),
};
export const WithExclusiveNoneOption: Story = {
+ args: {
+ legend: 'Do you have any of these symptoms?',
+ hint: 'Select all the symptoms you have',
+ },
render: (args) => (
-
+
+ Sore throat
+ Runny nose
+ Muscle or joint pain
+
+
+ None
+
+
),
};
export const WithError: Story = {
+ args: {
+ legend: 'What types of waste do you transport regularly?',
+ hint: 'Select all that apply',
+ },
render: (args) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const [error, setError] = useState('Please select an option');
return (
-
+ >
);
},
name: 'With Error (String)',
@@ -228,7 +176,7 @@ export const NoIDSupplied: Story = {
}, []);
return (
-
+ >
);
},
};
@@ -312,7 +260,7 @@ export const NameSupplied: Story = {
}, []);
return (
-
+ >
);
},
};
@@ -396,7 +344,7 @@ export const IDPrefixSupplied: Story = {
}, []);
return (
-
+ >
);
},
};
@@ -481,7 +429,7 @@ export const IDPrefixAndNameSupplied: Story = {
}, []);
return (
-
+ >
);
},
};
@@ -555,7 +503,7 @@ export const OnChangeAndOnInputHandlers: Story = {
};
return (
-
+ >
);
},
};
diff --git a/stories/Form Elements/DateInput.stories.tsx b/stories/Form Elements/DateInput.stories.tsx
index 516f13a32..674c18552 100644
--- a/stories/Form Elements/DateInput.stories.tsx
+++ b/stories/Form Elements/DateInput.stories.tsx
@@ -5,13 +5,18 @@ import { DateInput, type DateInputValue } from '#components';
const meta: Meta = {
title: 'Form Elements/DateInput',
component: DateInput,
+ args: {
+ legend: 'What is your date of birth?',
+ legendProps: { isPageHeading: true, size: 'l' },
+ hint: 'For example, 15 3 1984',
+ },
};
export default meta;
type Story = StoryObj;
export const Standard: Story = {
- render: () => (
-
+ render: (args) => (
+ <>
Scenario: onChange and onInput handlers are bound without any other props
Expected Behaviour
@@ -19,19 +24,14 @@ export const Standard: Story = {
- );
+ args: {
+ value: {
+ day: '20',
+ month: '09',
+ year: '1996',
+ },
+ },
+ render: (args) => {
+ return ;
},
};
export const ChangeableControlledElement: Story = {
- render: function ChangeableControlledElementRender() {
+ render: function ChangeableControlledElementRender(args) {
const [value, setValue] = useState | undefined>({
day: '20',
month: '09',
year: '1996',
});
- return (
- setValue(e.currentTarget.value)}
- />
- );
+ return setValue(e.currentTarget.value)} {...args} />;
},
};
diff --git a/stories/Form Elements/ErrorMessage.stories.tsx b/stories/Form Elements/ErrorMessage.stories.tsx
index a60c23d38..f72a05fdd 100644
--- a/stories/Form Elements/ErrorMessage.stories.tsx
+++ b/stories/Form Elements/ErrorMessage.stories.tsx
@@ -3,24 +3,6 @@ import { ErrorMessage } from '#components';
/**
* This component can be found in the `nhsuk-frontend` repository here.
- *
- * ## Implementation Notes
- *
- * The `ErrorMessage` component has a default `visuallyHiddenText` of "Error: ". This can be overriden using `visuallyHiddenText`.
- *
- * ## Usage
- *
- * ### Standard
- *
- * ```jsx
- * import { ErrorMessage } from "nhsuk-react-components";
- *
- * const Element = () => {
- * return (
- * Enter your full name
- * );
- * }
- * ```
*/
const meta: Meta = {
title: 'Form Elements/ErrorMessage',
@@ -28,13 +10,19 @@ const meta: Meta = {
args: {
children: 'Enter your full name',
},
+ argTypes: {
+ visuallyHiddenText: {
+ control: 'text',
+ table: {
+ defaultValue: { summary: 'Error' },
+ },
+ },
+ },
};
export default meta;
type Story = StoryObj;
-export const Standard: Story = {
- argTypes: { visuallyHiddenText: { control: false } },
-};
+export const Standard: Story = {};
export const CustomVisuallyHiddenText: Story = {
args: { visuallyHiddenText: 'Custom' },
diff --git a/stories/Form Elements/ErrorSummary.stories.tsx b/stories/Form Elements/ErrorSummary.stories.tsx
index 16efba9b4..79002df37 100644
--- a/stories/Form Elements/ErrorSummary.stories.tsx
+++ b/stories/Form Elements/ErrorSummary.stories.tsx
@@ -4,35 +4,13 @@ import { ErrorSummary } from '#components';
/**
* This component can be found in the `nhsuk-frontend` repository here.
*
- * ## Implementation Notes
+ * ## Implementation notes
*
* The `ErrorSummary` component has three subcomponents:
*
* - `ErrorSummary.Title`
* - `ErrorSummary.List`
* - `ErrorSummary.ListItem`
- *
- * ## Usage
- *
- * ### Standard
- *
- * ```jsx
- * import { ErrorSummary } from "nhsuk-react-components";
- *
- * const Element = () => {
- * return (
- *
- * There is a problem
- *
Describe the errors and how to correct them
- *
- *
- * Date of birth must be in the past
- *
- *
- *
- * );
- * }
- * ```
*/
const meta: Meta = {
title: 'Form Elements/ErrorSummary',
@@ -43,7 +21,7 @@ type Story = StoryObj;
export const Standard: Story = {
render: (args) => (
-
+ There is a problemEnter your full name
@@ -54,7 +32,7 @@ export const Standard: Story = {
export const WithDescription: Story = {
render: (args) => (
-
+ There is a problem
Describe the errors and how to correct them
@@ -67,8 +45,11 @@ export const WithDescription: Story = {
};
export const WithAutoFocusDisabled: Story = {
+ args: {
+ disableAutoFocus: true,
+ },
render: (args) => (
-
+ There is a problem
diff --git a/stories/Form Elements/Fieldset.stories.tsx b/stories/Form Elements/Fieldset.stories.tsx
index 9441b6c04..cb4e4c16d 100644
--- a/stories/Form Elements/Fieldset.stories.tsx
+++ b/stories/Form Elements/Fieldset.stories.tsx
@@ -3,28 +3,6 @@ import { Fieldset, TextInput } from '#components';
/**
* This component can be found in the `nhsuk-frontend` repository here.
- *
- * ## Implementation Notes
- *
- * The `Fieldset` component has one subcomponent: `Fieldset.Legend`.
- *
- * The `Fieldset.Legend` component has one default prop: `headingLevel: 'h1'`. This can be overridden and any valid heading level can be used (i.e. `h1`, `h2`).
- *
- * ## Usage
- *
- * ### Standard
- *
- * ```jsx
- * import { Fieldset } from "nhsuk-react-components";
- *
- * const Element = () => {
- * return (
- *
- * );
- * }
- * ```
*/
const meta: Meta = {
title: 'Form Elements/Fieldset',
@@ -35,8 +13,10 @@ type Story = StoryObj;
export const Standard: Story = {
render: (args) => (
-