From 8cdd5c5c27bfa661ef14988e833a78713c719b5d Mon Sep 17 00:00:00 2001 From: Tobias Barsnes Date: Tue, 10 Sep 2024 08:31:57 +0200 Subject: [PATCH] feat(Heading): default level is now 2 (#2378) resolves #2358 --- .changeset/rich-carrots-deny.md | 5 +++++ .../react/src/components/Typography/Heading/Heading.tsx | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/rich-carrots-deny.md diff --git a/.changeset/rich-carrots-deny.md b/.changeset/rich-carrots-deny.md new file mode 100644 index 0000000000..52a5716b18 --- /dev/null +++ b/.changeset/rich-carrots-deny.md @@ -0,0 +1,5 @@ +--- +"@digdir/designsystemet-react": patch +--- + +Heading: default level is now 2 diff --git a/packages/react/src/components/Typography/Heading/Heading.tsx b/packages/react/src/components/Typography/Heading/Heading.tsx index 2e5f6b9a07..2a6c5cc74e 100644 --- a/packages/react/src/components/Typography/Heading/Heading.tsx +++ b/packages/react/src/components/Typography/Heading/Heading.tsx @@ -6,7 +6,7 @@ import { forwardRef } from 'react'; export type HeadingProps = { /** * Heading level. This will translate into any h1-6 level unless `asChild` is `true` - * @default 1 + * @default 2 */ level?: 1 | 2 | 3 | 4 | 5 | 6; /** Changes text sizing @@ -31,10 +31,10 @@ export type HeadingProps = { */ export const Heading = forwardRef( ( - { size = 'xl', level = 1, spacing = false, className, asChild, ...rest }, + { size = 'xl', level = 2, spacing = false, className, asChild, ...rest }, ref, ) => { - const Component = asChild ? Slot : (`h${level ?? 1}` as ElementType); + const Component = asChild ? Slot : (`h${level}` as ElementType); return (