diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live.mdx b/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live.mdx new file mode 100644 index 00000000000..d966b2d928b --- /dev/null +++ b/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live.mdx @@ -0,0 +1,15 @@ +--- +title: 'AriaLive' +description: 'AriaLive is a React component and hook that helps make your web app more accessible by announcing dynamic changes to screen readers.' +showTabs: true +hideTabs: + - title: Events +theme: 'sbanken' +status: 'new' +--- + +import AriaLiveInfo from 'Docs/uilib/components/aria-live/info' +import AriaLiveDemos from 'Docs/uilib/components/aria-live/demos' + + + diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live/Examples.tsx new file mode 100644 index 00000000000..f229cd1faf8 --- /dev/null +++ b/packages/dnb-design-system-portal/src/docs/uilib/components/aria-live/Examples.tsx @@ -0,0 +1,154 @@ +/** + * UI lib Component Example + * + */ + +import React from 'react' +import { Field, FieldBlock, Form } from '@dnb/eufemia/src/extensions/forms' +import ComponentBox from '../../../../shared/tags/ComponentBox' +import { AriaLive, Button, Flex, P } from '@dnb/eufemia/src' + +export const AriaLivePlayground = () => ( + + {() => { + const priorities = ['low', 'high'] + const contents = { + default: 'This is a default announcement', + second: 'And a second one', + third: 'A third one', + fourth: 'And a fourth one', + } + const priority: 'low' | 'high' = 'low' + const defaultData = { + enabled: false, + content: contents.default, + priority, + } + + function AriaLiveExample() { + const { data } = Form.useData('aria-live-playground', defaultData) + + return ( + + + + + {priorities.map((content) => { + return ( + + ) + })} + + + + {Object.entries(contents).map(([key, value]) => { + return ( + + ) + })} + + + + + + Output:{' '} + + Message: {data.content} + + + + + ) + } + + return + }} + +) + +export const AriaLiveAdditions = () => ( + + {() => { + const defaultData = { + enabled: false, + content: [

Line 1

], + } + + function AriaLiveExample() { + const { data, update } = Form.useData( + 'aria-live-additions', + defaultData, + ) + + return ( + + + + + + +