` with SuomifiTheme reset styles applied,
* whereas "div" renders a plain HTML `
`. "Span" gets rendered with `display: inline-block` style
* @default default
@@ -120,9 +122,6 @@ const StyledBlock = styled((props: BlockProps & SuomifiThemeProp) => {
${({ theme, variant }) => baseStyles(theme, variant)}
`;
-/**
- * Used in displaying a generic piece of HTML e.g. a div
- */
const Block = forwardRef((props: BlockProps, ref: React.Ref
) => (
{({ suomifiTheme }) => (
diff --git a/src/core/Breadcrumb/Breadcrumb/Breadcrumb.md b/src/core/Breadcrumb/Breadcrumb/Breadcrumb.md
index bd932257a..08d188f50 100644
--- a/src/core/Breadcrumb/Breadcrumb/Breadcrumb.md
+++ b/src/core/Breadcrumb/Breadcrumb/Breadcrumb.md
@@ -1,11 +1,30 @@
-Breadcrumb component is used to let the user know their current location in the service. Use an aria-label which describes this function.
+The `` component is used to let the user know their current location in a web service. It is rendered as an HTML `nav` element.
+
+Examples:
+
+- [Basic use](/#/Components/Breadcrumb?id=basic-use)
+
+
+ [Props & methods (Breadcrumb)](/#/Components/Breadcrumb?id=props--methods)
+
+
+ [Props & methods (BreadcrumbLink)](/#/Components/Breadcrumb?id=breadcrumblink)
+
+
+### Basic use
+
+Use an `aria-label` to describe the purpose of the Breadcrumb element and distinguish it from other navigation landmarks on the same page.
+
+Mark the current page with the `current` prop.
```jsx
import { Breadcrumb, BreadcrumbLink } from 'suomifi-ui-components';
- Frontpage
- Sub page
- Sub sub page
+ Home
+ Citizens
+ Social security
;
```
+
+### Props & methods
diff --git a/src/core/Breadcrumb/Breadcrumb/Breadcrumb.tsx b/src/core/Breadcrumb/Breadcrumb/Breadcrumb.tsx
index 7d3c9c733..df2a51a33 100644
--- a/src/core/Breadcrumb/Breadcrumb/Breadcrumb.tsx
+++ b/src/core/Breadcrumb/Breadcrumb/Breadcrumb.tsx
@@ -41,10 +41,6 @@ const StyledBreadcrumb = styled(BaseBreadcrumb)`
${({ theme }) => baseStyles(theme)}
`;
-/**
- *
- * Indicator for the user's current location in the service.
- */
const Breadcrumb = (props: BreadcrumbProps) => {
const { 'aria-label': ariaLabel, ...passProps } = props;
return (
diff --git a/src/core/Button/Button.md b/src/core/Button/Button.md
index 4cf557b32..1515d1049 100644
--- a/src/core/Button/Button.md
+++ b/src/core/Button/Button.md
@@ -1,124 +1,134 @@
+`
- } aria-labelledby="button-label">
- Login iconRight="login"
- aria-labelledby="button-label"
-
+ }>Proceed
+
+ }>Proceed
>;
```
-```js
-import { Button } from 'suomifi-ui-components';
-import { IconLogin } from 'suomifi-icons';
+### Secondary button
-<>
-
- Inverted Button
-
- }
- >
- Inverted Button disabled fullWidth icon="login"
-
-
->;
-```
+A secondary Button is used for an optional action. A borderless variant can be used to further diminsh the Button's notability.
```js
import { Button } from 'suomifi-ui-components';
-import { IconLogin } from 'suomifi-icons';
<>
- Button
+ Go back
- }>
- Secondary Button icon="login"
-
+ Go back
+>;
+```
- }>
- Secondary Button disabled fullWidth icon="login"
-
+### Light secondary button
-
- Borderless secondary Button
-
+A light secondary Button is used for a noteworthy but not necessarily required action. Example use case: a table where the Button is repeated on every row.
- }>
- Borderless secondary Button icon="login"
-
+```js
+import { Button } from 'suomifi-ui-components';
- }>
- Borderless secondary Button disabled icon="login"
-
->;
+Edit row;
```
-```js
-import { Button } from 'suomifi-ui-components';
-import { IconLogin } from 'suomifi-icons';
+### Inverted button
-<>
- Light secondary button
+An inverted Button is used on colored backgrounds.
- }>
- Light secondary Button disabled icon="login"
-
->;
+```js
+import {
+ Button,
+ Block,
+ suomifiDesignTokens
+} from 'suomifi-ui-components';
+
+
+ Open
+;
```
+
+### Props & methods
diff --git a/src/core/Button/Button.tsx b/src/core/Button/Button.tsx
index 8295a1b32..1e8ddfe77 100644
--- a/src/core/Button/Button.tsx
+++ b/src/core/Button/Button.tsx
@@ -26,7 +26,8 @@ export interface ButtonProps
children?: ReactNode;
/**
* Define a label if button's text content does not indicate the button's purpose (for example, button with only an icon).
- * Alternatively you can define an aria-labelledby
+ * If the button has a visible label, make sure the aria-label includes the visible text.
+ * Alternatively you can define an `aria-labelledby`.
*/
'aria-label'?: string;
/** Disables the button */
@@ -111,10 +112,7 @@ const StyledButton = styled(
)`
${({ theme }) => baseStyles(theme)}
`;
-/**
- *
- * Use for inside Application onClick events.
- */
+
const Button = forwardRef(
(props: ButtonProps, ref: React.RefObject) => (
diff --git a/src/core/Chip/Chip/Chip.md b/src/core/Chip/Chip/Chip.md
index a340f8e76..5a3fdb84a 100644
--- a/src/core/Chip/Chip/Chip.md
+++ b/src/core/Chip/Chip/Chip.md
@@ -1,54 +1,89 @@
+The `` component is used when you want to present concise information in a clear visually prominent way, for example to display the selected values of a listbox. In its most typical usecase, the Chip is a button with a "remove" icon.
+
+Examples:
+
+- [Basic use](/#/Components/Chip?id=basic-use)
+- [Without remove icon](/#/Components/Chip?id=without-remove-icon)
+- [Disabled](/#/Components/Chip?id=disabled)
+- [Static chip](/#/Components/Chip?id=static-chip)
+
+
+ [Props & methods (Chip)](/#/Components/Chip?id=props--methods)
+
+
+ [Props & methods (StaticChip)](/#/Components/Chip?id=staticchip)
+
+
+### Basic use
+
+It is important to set the `actionLabel` text so that can describe the function of the Chip.
+
+```js
+import { Chip } from 'suomifi-ui-components';
+
+ console.log('Deselected: Finland')}
+>
+ Finland
+;
+```
+
+### Without remove icon
+
+The remove icon can be hidden to allow for more use cases
+
```js
import { Chip } from 'suomifi-ui-components';
-import React from 'react';
-
-const removeAction = () => {
- alert('Selection removed');
-};
-
-const exampleRef = React.createRef();
-const chipStyle = {
- display: 'inline-block',
- marginRight: '10px',
- marginBottom: '24px'
-};
+
+ console.log('Clicked option: Finland')}
+>
+ Finland
+;
+```
+
+### Disabled
+
+In the example below
+
+- The first Chip is fully `disabled`
+- The second one is `aria-disabled`. Aria-disabled allows focus but disables the Chip's `onClick()` functionality.
+
+```js
+import { Chip } from 'suomifi-ui-components';
+
<>
-
-
- Removable chip
-
- {
- console.log(exampleRef.current);
- removeAction();
- }}
- >
- Removable chip with ref
-
-
-
-
- Clickable chip without remove icon
-
-
-
-
- Chip with a
- reallyReallyLongWeirdWordThatNeedsToBeBrokenToFitInToTheChip and
- content that doesn't fit in one line and spans multiple lines.
+ console.log('Deselected: Finland')}
+ >
+ Finland
- Disabled chip
-
- Aria-disabled chip
+ console.log('Deselected: Finland')}
+ >
+ Finland
+
>;
```
+
+### Static chip
+
+`` is a Chip without the button functionality, i.e only for visual presentation.
+
+```js
+import { StaticChip } from 'suomifi-ui-components';
+
+Finland;
+```
+
+### Props & methods
diff --git a/src/core/Chip/StaticChip/StaticChip.md b/src/core/Chip/StaticChip/StaticChip.md
index f5d933544..e69de29bb 100644
--- a/src/core/Chip/StaticChip/StaticChip.md
+++ b/src/core/Chip/StaticChip/StaticChip.md
@@ -1,24 +0,0 @@
-```js
-import { StaticChip } from 'suomifi-ui-components';
-import React from 'react';
-
-const chipStyle = {
- display: 'inline-block',
- marginRight: '10px',
- marginBottom: '24px'
-};
-
-<>
-
- Basic static chip
-
- Disabled static chip
-
-
-
- Static chip with a
- reallyReallyLongWeirdWordThatNeedsToBeBrokenToFitInToTheChip and
- content that doesn't fit in one line and spans multiple lines.
-
->;
-```
diff --git a/src/core/Dropdown/Dropdown/Dropdown.md b/src/core/Dropdown/Dropdown/Dropdown.md
index 976bd0493..cbc1be850 100644
--- a/src/core/Dropdown/Dropdown/Dropdown.md
+++ b/src/core/Dropdown/Dropdown/Dropdown.md
@@ -1,238 +1,378 @@
+The `` component is used to select a value from a list of options. The component is rendered as a combination of a `` element and an ARIA listbox. It should be used when the amount of options is manageable in size, i.e. the user does not need filtering to find the correct option.
+
+If there are a lot of options in the list, consider using the filterable SingleSelect component or filter the list beforehand with some additional logic.
+
+If there are only 2-3 options, consider using the RadioButton component instead.
+
+Examples:
+
+- [Basic use](/#/Components/Dropdown?id=basic-use)
+- [Default value](/#/Components/Dropdown?id=default-value)
+- [Controlled value](/#/Components/Dropdown?id=controlled-value)
+- [Accessing the component with ref](/#/Components/Dropdown?id=accessing-the-component-with-ref)
+- [Error status](/#/Components/Dropdown?id=error-status)
+- [Disabled](/#/Components/Dropdown?id=disabled)
+- [Full width](/#/Components/Dropdown?id=full-width)
+- [Tooltip](/#/Components/Dropdown?id=tooltip)
+
+
+ [Props & methods (Dropdown)](/#/Components/Dropdown?id=props--methods)
+
+
+ [Props & methods (DropdownItem)](/#/Components/Dropdown?id=dropdownitem)
+
+
+### Basic use
+
+Use `` components to compose list.
+
+If instructions are needed, use the `hintText` prop.
+
+The `visualPlaceholder` prop is used to apply a placeholder text to the input. For accessibility reasons, do not use placeholders for instructions.
+
```js
-import React from 'react';
import { Dropdown, DropdownItem } from 'suomifi-ui-components';
-const [selectedValue, setSelectedValue] = React.useState(null);
-const [status, setStatus] = React.useState('default');
+const countries = [
+ {
+ name: 'Finland',
+ key: 'finland'
+ },
+ {
+ name: 'Sweden',
+ key: 'sweden'
+ },
+ {
+ name: 'Norway',
+ key: 'norway'
+ },
+ {
+ name: 'Denmark',
+ key: 'denmark'
+ },
+ {
+ name: 'Iceland',
+ key: 'iceland'
+ }
+];
{
- setStatus('default');
- setSelectedValue(value);
- }}
- onBlur={() => {
- if (!selectedValue) {
- setStatus('error');
- } else {
- setStatus('default');
- }
- }}
- status={status}
- statusText={status === 'error' ? 'You must select a value.' : ''}
- visualPlaceholder="Select a value"
+ labelText="Country"
+ hintText="Select your current country of residence"
+ visualPlaceholder="Choose country"
>
-
- Dropdown Item 1
-
-
- Dropdown Item 2
-
-
- Dropdown Item 3
-
-
- Dropdown Item 4
-
-
- Dropdown Item 5
-
-
- Dropdown Item 6
-
-
- Dropdown Item 7
-
-
- Dropdown Item 8
-
-
- Dropdown Item 9
-
-
- Dropdown Item 10
-
-
- Dropdown Item 11
-
-
- Dropdown Item 12
-
-
- Dropdown Item 13
-
-
- Dropdown Item 14
-
-
- Dropdown Item 15
-
+ {countries.map((country) => (
+
+ {country.name}
+
+ ))}
;
```
+### Default value
+
+Set the input's initial value with the `defaultValue` prop. The default value must match with the value of some DropdownItem in the list.
+
```js
import { Dropdown, DropdownItem } from 'suomifi-ui-components';
-import { createRef } from 'react';
-const exampleRef = createRef();
-<>
- console.log(exampleRef.current)}
- fullWidth
- >
-
- Dropdown Item 1
-
-
- Dropdown Item 2
-
-
+const countries = [
+ {
+ name: 'Finland',
+ key: 'finland'
+ },
+ {
+ name: 'Sweden',
+ key: 'sweden'
+ },
+ {
+ name: 'Norway',
+ key: 'norway'
+ },
+ {
+ name: 'Denmark',
+ key: 'denmark'
+ },
+ {
+ name: 'Iceland',
+ key: 'iceland'
+ }
+];
-
-
- Dropdown Item 1
+
+ {countries.map((country) => (
+
+ {country.name}
-
- Dropdown Item 2
+ ))}
+;
+```
+
+### Controlled value
+
+Use the `value` prop to access and control the input's value programmatically.
+
+A typical use case involves setting the value manually in the `onChange()` function.
+
+```js
+import { Dropdown, DropdownItem } from 'suomifi-ui-components';
+import { useState } from 'react';
+
+const [controlledValue, setControlledValue] = useState('');
+
+const countries = [
+ {
+ name: 'Finland',
+ key: 'finland'
+ },
+ {
+ name: 'Sweden',
+ key: 'sweden'
+ },
+ {
+ name: 'Norway',
+ key: 'norway'
+ },
+ {
+ name: 'Denmark',
+ key: 'denmark'
+ },
+ {
+ name: 'Iceland',
+ key: 'iceland'
+ }
+];
+
+ setControlledValue(newValue)}
+>
+ {countries.map((country) => (
+
+ {country.name}
-
->;
+ ))}
+;
```
+### Accessing the component with ref
+
+The component can be accessed programmatically with React ref. The ref points to the Dropdown's `` element, and contains the `` with selected value within.
+
```js
-import React from 'react';
import { Dropdown, DropdownItem } from 'suomifi-ui-components';
+import { useRef } from 'react';
+
+const dropdownRef = useRef();
-const [selectedValue, setSelectedValue] = React.useState(null);
-const [status, setStatus] = React.useState('default');
+const countries = [
+ {
+ name: 'Finland',
+ key: 'finland'
+ },
+ {
+ name: 'Sweden',
+ key: 'sweden'
+ },
+ {
+ name: 'Norway',
+ key: 'norway'
+ },
+ {
+ name: 'Denmark',
+ key: 'denmark'
+ },
+ {
+ name: 'Iceland',
+ key: 'iceland'
+ }
+];
console.log(dropdownRef.current)}
>
-
- Dropdown Item 1
-
-
- Dropdown Item 2
-
-
- Dropdown Item 3
-
-
- Dropdown Item 4
-
-
- Dropdown Item 5
-
+ {countries.map((country) => (
+
+ {country.name}
+
+ ))}
;
```
+### Error status
+
+Control the error status of the component using the `status` and `statusText` props.
+
```js
-import { useState } from 'react';
import { Dropdown, DropdownItem } from 'suomifi-ui-components';
+import { useState } from 'react';
+
+const [status, setStatus] = useState('error');
-const [value, setValue] = useState('');
+const countries = [
+ {
+ name: 'Finland',
+ key: 'finland'
+ },
+ {
+ name: 'Sweden',
+ key: 'sweden'
+ },
+ {
+ name: 'Norway',
+ key: 'norway'
+ },
+ {
+ name: 'Denmark',
+ key: 'denmark'
+ },
+ {
+ name: 'Iceland',
+ key: 'iceland'
+ }
+];
{
- if (window.confirm('Change dropdown value?')) {
- setValue(newValue);
- }
- }}
+ labelText="Country"
+ hintText="Select your current country of residence"
+ onChange={() => setStatus('default')}
+ status={status}
+ statusText={status === 'error' ? 'This field is required' : ''}
>
-
- Dropdown Item 1
-
-
- Dropdown Item 2
-
+ {countries.map((country) => (
+
+ {country.name}
+
+ ))}
;
```
+### Disabled
+
+The entire input or individual options can be disabled
+
```js
-import { Dropdown, DropdownItem, Block } from 'suomifi-ui-components';
-
-const dropdownProps = {
- 'aria-labelledby': 'dropdown-group',
- onChange: (newValue) => console.log(newValue)
-};
-
-
-
-
-
-
- Dropdown 1 Item 1
-
-
- Dropdown 1 Item 2
-
-
-
-
-
-
- Dropdown 2 Item 1
+import { Dropdown, DropdownItem } from 'suomifi-ui-components';
+
+const countries = [
+ {
+ name: 'Finland',
+ key: 'finland',
+ disabled: false
+ },
+ {
+ name: 'Sweden',
+ key: 'sweden',
+ disabled: false
+ },
+ {
+ name: 'Norway',
+ key: 'norway',
+ disabled: false
+ },
+ {
+ name: 'Denmark',
+ key: 'denmark',
+ disabled: false
+ },
+ {
+ name: 'Iceland',
+ key: 'iceland',
+ disabled: true
+ }
+];
+
+<>
+
+ {countries.map((country) => (
+
+ {country.name}
-
- Dropdown 2 Item 2
+ ))}
+
+
+
+ {countries.map((country) => (
+
+ {country.name}
-
-
-
;
+ ))}
+
+>;
```
-### Drodown as action menu
+### Full width
+
+You can use the `fullWidth` prop to make the input take all available horizontal space.
```js
import { Dropdown, DropdownItem } from 'suomifi-ui-components';
+const countries = [
+ {
+ name: 'Finland',
+ key: 'finland'
+ },
+ {
+ name: 'Sweden',
+ key: 'sweden'
+ },
+ {
+ name: 'Norway',
+ key: 'norway'
+ },
+ {
+ name: 'Denmark',
+ key: 'denmark'
+ },
+ {
+ name: 'Iceland',
+ key: 'iceland'
+ }
+];
+
console.log(action, 'selected')}
+ labelText="Country"
+ hintText="Select your current country of residence"
+ visualPlaceholder="Choose country"
+ fullWidth
>
- Action Item 1
- Action Item 2
+ {countries.map((country) => (
+
+ {country.name}
+
+ ))}
;
```
-### Dropdown with a tooltip
+### Tooltip
+
+A `` component can be used with Dropdown to provide additional information.
+
+In terms of instructive texts, Tooltip should only be used as a "last resort" when the info text is too long for `hintText`. Tooltip can be used for other nice-to-know information.
+
+For instructions regarding how to ensure your Tooltip is accessible, please refer to the [Tooltip documentation](/#/Components/Tooltip).
```js
import {
@@ -243,24 +383,56 @@ import {
Text
} from 'suomifi-ui-components';
-const labelText = 'Dropdown with a tooltip';
+const labelText = 'Country';
+
+const countries = [
+ {
+ name: 'Finland',
+ key: 'finland'
+ },
+ {
+ name: 'Sweden',
+ key: 'sweden'
+ },
+ {
+ name: 'Norway',
+ key: 'norway'
+ },
+ {
+ name: 'Denmark',
+ key: 'denmark'
+ },
+ {
+ name: 'Iceland',
+ key: 'iceland'
+ }
+];
- Tooltip
+ Why you are being asked this information?
- Text content for the tooltip
+
+ Country of residence information is used to provide you
+ personalized assistance in your local area.
+
}
>
- Item 1
- Item 2
+ {countries.map((country) => (
+
+ {country.name}
+
+ ))}
;
```
+
+### Props & methods
diff --git a/src/core/Dropdown/Dropdown/Dropdown.tsx b/src/core/Dropdown/Dropdown/Dropdown.tsx
index f3683aa9f..55ff190f0 100644
--- a/src/core/Dropdown/Dropdown/Dropdown.tsx
+++ b/src/core/Dropdown/Dropdown/Dropdown.tsx
@@ -115,7 +115,7 @@ export interface DropdownProps extends StatusTextCommonProps {
/** Text to mark the Dropdown optional. Will be wrapped in parentheses and shown after `labelText` */
optionalText?: string;
/**
- * Id on an additional label id. E.g. form group label.
+ * Id of an external label e.g. input group label.
* Used in addition to `labelText` for screen readers.
*/
'aria-labelledby'?: string;
@@ -667,10 +667,6 @@ const StyledDropdown = styled(
${({ theme }) => baseStyles(theme)}
`;
-/**
- *
- * Use for selectable dropdown with items.
- */
const Dropdown = forwardRef(
(props: DropdownProps, ref: React.RefObject) => {
const { id: propId, ...passProps } = props;
diff --git a/src/core/Expander/Expander/Expander.md b/src/core/Expander/Expander/Expander.md
index 9827054b7..23abc11b6 100644
--- a/src/core/Expander/Expander/Expander.md
+++ b/src/core/Expander/Expander/Expander.md
@@ -1,46 +1,137 @@
+The `` component is used to hide information under an expandable title. Expanders can shorten an otherwise lengthy page and make it easier to perceive a page with a lot of information.
+
+Examples:
+
+- [Basic use](/#/Components/Expander?id=basic-use)
+- [Default open](/#/Components/Expander?id=default-open)
+- [Heading semantics](/#/Components/Expander?id=heading-semantics)
+- [Expanders in group](/#/Components/Expander?id=expanders-in-group)
+- [Group without open/close all button](/#/Components/Expander?id=group-without-openclose-all-button)
+- [Controlled state](/#/Components/Expander?id=controlled-state)
+- [Interactive elements in Expander title](/#/Components/Expander?id=interactive-elements-in-expander-title)
+
+
+ [Props & methods (Expander)](/#/Components/Expander?id=props--methods)
+
+
+ [Props & methods (ExpanderTitleButton)](/#/Components/Expander?id=expandertitlebutton)
+
+
+ [Props & methods (ExpanderContent)](/#/Components/Expander?id=expandercontent)
+
+
+ [Props & methods (ExpanderGroup)](/#/Components/Expander?id=expandergroup)
+
+
+ [Props & methods (ExpanderTitle)](/#/Components/Expander?id=expandertitle)
+
+
+### Basic use
+
+Compose the Expander using `` and ``
+
```jsx
import {
Expander,
ExpanderTitleButton,
- ExpanderContent
+ ExpanderContent,
+ Paragraph
} from 'suomifi-ui-components';
-
-
- Test expander
+
+
+ Assistance with financial problems
- Test expander
+
+
+ If your company is experiencing financial or payment
+ difficulties, please contact the Yrittäjän talousapu counselling
+ service.
+
+
+ Telephone Service 0295 024 882
+
+ Monday - Friday 9.00–16.15
+
;
```
+### Default open
+
+Use the `defaultOpen` prop to make the Expander show its content on first render.
+
```jsx
import {
Expander,
- ExpanderTitle,
+ ExpanderTitleButton,
ExpanderContent,
- Checkbox
+ Paragraph
} from 'suomifi-ui-components';
-
-
-
- Checkbox label
-
-
- Test expander
+
+
+ Assistance with financial problems
+
+
+
+ If your company is experiencing financial or payment
+ difficulties, please contact the Yrittäjän talousapu counselling
+ service.
+
+
+ Telephone Service 0295 024 882
+
+ Monday - Friday 9.00–16.15
+
+;
+```
+
+### Heading semantics
+
+You can use the `asHeading` prop in ExpanderTitleButton to render the Expander button inside a heading element. Should always be used when the ExpanderContent might contain subheadings. Make sure the heading hierarchy is logical.
+
+```jsx
+import {
+ Expander,
+ ExpanderTitleButton,
+ ExpanderContent,
+ Paragraph
+} from 'suomifi-ui-components';
+
+
+
+ Assistance with financial problems
+
+
+
+ If your company is experiencing financial or payment
+ difficulties, please contact the Yrittäjän talousapu counselling
+ service.
+
+
+ Telephone Service 0295 024 882
+
+ Monday - Friday 9.00–16.15
+
;
```
+### Expanders in group
+
+Use the `` wrapper to group Expanders together.
+
+All Expanders in a group can be toggled simultaneously with a close/open all button (`openAllText` and `closeAllText` props).
+
+For screen readers, it is recommended to provide a more descriptive label for the button using the `ariaOpenAllText` and `ariaCloseAllText` props.
+
```jsx
import {
Expander,
ExpanderGroup,
ExpanderTitleButton,
- ExpanderContent
+ ExpanderContent,
+ Paragraph,
+ Text
} from 'suomifi-ui-components';
- Test expander 1
- Test expander content 1
+
+ Can I manage my own devices?
+
+
+
+ You can manage the devices you use:
+
+
+ In the Suomi.fi application
+
+ - Settings: Login and Security
+
+
+ In the Suomi.fi Web Service or mobile device browser{' '}
+
+
+ - Messages section: Device Manager
+
+
+
+ Device data will include the name of each device and the time
+ at which the application has last been used. You can log out
+ of the Suomi.fi application the devices you choose. Logging
+ out will remove all Suomi.fi applications from the device you
+ have selected. In this case, the Suomi.fi Messages cannot be
+ used on the device until a new e-identification.
+
+
- Test expander 2
- Test expander content 2
+
+ Is the application secure?
+
+
+
+ Suomi.fi Messages is a secure way to communicate with
+ organisations that use the service.
+
+ -
+ The messages and attachments shown in the application are
+ transmitted in encrypted form between the mobile device
+ and the server.
+
+ -
+ The app requires permissions to use your mobile device’s
+ photographs and other files, so it can process attachments
+ included in messages.
+
+ -
+ The user is individually identified using strong
+ identification. This means that you are the only person
+ who can access your data.
+
+
+
+
+ If you break your mobile device or lose it, you can sign out
+ of the Suomi.fi application either in the Suomi.fi web service
+ or by using another phone.
+
+
- Test expander 3
- Test expander content 3
+
+ Errors in the Suomi.fi mobile application
+
+
+
+ If the application does not work on your mobile device for
+ some reason, you can also read your messages via a browser
+
+
+ Errors occurring in the Suomi.fi application generally do not
+ affect the preservation of Suomi.fi Messages.
+
+
;
```
+### Group without open/close all button
+
+You can hide the open/close all button of the group with `showToggleAllButton={false}`
+
```jsx
import {
Expander,
ExpanderGroup,
ExpanderTitleButton,
- ExpanderContent
+ ExpanderContent,
+ Paragraph,
+ Text
} from 'suomifi-ui-components';
- Test expander 1
- Test expander content 1
+
+ Can I manage my own devices?
+
+
+
+ You can manage the devices you use:
+
+
+ In the Suomi.fi application
+
+ - Settings: Login and Security
+
+
+ In the Suomi.fi Web Service or mobile device browser{' '}
+
+
+ - Messages section: Device Manager
+
+
+
+ Device data will include the name of each device and the time
+ at which the application has last been used. You can log out
+ of the Suomi.fi application the devices you choose. Logging
+ out will remove all Suomi.fi applications from the device you
+ have selected. In this case, the Suomi.fi Messages cannot be
+ used on the device until a new e-identification.
+
+
- Test expander 2
- Test expander content 2
+
+ Is the application secure?
+
+
+
+ Suomi.fi Messages is a secure way to communicate with
+ organisations that use the service.
+
+ -
+ The messages and attachments shown in the application are
+ transmitted in encrypted form between the mobile device
+ and the server.
+
+ -
+ The app requires permissions to use your mobile device’s
+ photographs and other files, so it can process attachments
+ included in messages.
+
+ -
+ The user is individually identified using strong
+ identification. This means that you are the only person
+ who can access your data.
+
+
+
+
+ If you break your mobile device or lose it, you can sign out
+ of the Suomi.fi application either in the Suomi.fi web service
+ or by using another phone.
+
+
- Test expander 3
- Test expander content 3
+
+ Errors in the Suomi.fi mobile application
+
+
+
+ If the application does not work on your mobile device for
+ some reason, you can also read your messages via a browser
+
+
+ Errors occurring in the Suomi.fi application generally do not
+ affect the preservation of Suomi.fi Messages.
+
+
;
```
-## Controlled
+### Controlled state
-- State for the individual Expanders are stored outside of the component and user has full control.
-- Therefore when clicking the individual Expander they are not opened by default, user have to give the logic to change it.
-- It's user's responsibility to keep the state stored outside to be updated as Open/Close All is used.
-- `defaultOpen` prop will not work when Expander is in controlled state == `open` prop is given.
+You can control the state of an individual Expander programmatically with the `open` prop.
```jsx
import {
Expander,
ExpanderGroup,
ExpanderTitleButton,
- ExpanderContent
+ ExpanderContent,
+ Paragraph,
+ Text
} from 'suomifi-ui-components';
+import { useState } from 'react';
-const [expanderThreeOpen, setExpanderThreeOpen] =
- React.useState(false);
+const [expanderOneOpen, setExpanderOneOpen] = useState(false);
+const [expanderTwoOpen, setExpanderTwoOpen] = useState(false);
+const [expanderThreeOpen, setExpanderThreeOpen] = useState(true);
<>
+ setExpanderTwoOpen(!expanderTwoOpen)}>
+ Toggle middle expader
+
-
- Test expander 1
- Test expander content 1
+
+
+ Can I manage my own devices?
+
+
+
+ You can manage the devices you use:
+
+
+ In the Suomi.fi application
+
+ - Settings: Login and Security
+
+
+ In the Suomi.fi Web Service or mobile device browser{' '}
+
+
+ - Messages section: Device Manager
+
+
+
+ Device data will include the name of each device and the
+ time at which the application has last been used. You can
+ log out of the Suomi.fi application the devices you choose.
+ Logging out will remove all Suomi.fi applications from the
+ device you have selected. In this case, the Suomi.fi
+ Messages cannot be used on the device until a new
+ e-identification.
+
+
-
- Test expander 2
- Test expander content 2
+
+
+ Is the application secure?
+
+
+
+ Suomi.fi Messages is a secure way to communicate with
+ organisations that use the service.
+
+ -
+ The messages and attachments shown in the application
+ are transmitted in encrypted form between the mobile
+ device and the server.
+
+ -
+ The app requires permissions to use your mobile device’s
+ photographs and other files, so it can process
+ attachments included in messages.
+
+ -
+ The user is individually identified using strong
+ identification. This means that you are the only person
+ who can access your data.
+
+
+
+
+ If you break your mobile device or lose it, you can sign out
+ of the Suomi.fi application either in the Suomi.fi web
+ service or by using another phone.
+
+
- {
- if (window.confirm('Toggle Expander 3')) {
- setExpanderThreeOpen(!open);
- }
- }}
- >
- Test expander 3
- Test expander content 3
+
+
+ Errors in the Suomi.fi mobile application
+
+
+
+ If the application does not work on your mobile device for
+ some reason, you can also read your messages via a browser
+
+
+ Errors occurring in the Suomi.fi application generally do
+ not affect the preservation of Suomi.fi Messages.
+
+
>;
```
+
+### Interactive elements in Expander title
+
+If you need to have interactive elements in the Expander title, use `` instead of ``.
+
+ExpanderTitle creates a smaller toggle button to the right side of the Expander. Generally `ariaOpenText`/`ariaCloseText` props should have the same value, because state is already communicated to assistive technology using `aria-expanded`. Point `toggleButtonAriaDescribedBy` to the ID of interactive element to provide additional context for assistive technology.
+
+```jsx
+import {
+ Expander,
+ ExpanderTitle,
+ ExpanderContent,
+ Checkbox,
+ Paragraph
+} from 'suomifi-ui-components';
+
+
+
+ Guardianship
+
+
+
+ Guardianship means the management of other persons’ finances and
+ looking after their interests when they are no longer able to do
+ it. Choose guardianship if the matters of a person close to you
+ cannot be managed in any other way.
+
+
+ You can safeguard the management of your property and other
+ personal matters with a continuing power of attorney.
+
+
+;
+```
+
+### Props & methods
diff --git a/src/core/Expander/Expander/Expander.tsx b/src/core/Expander/Expander/Expander.tsx
index 64f61cc73..10d9d831a 100644
--- a/src/core/Expander/Expander/Expander.tsx
+++ b/src/core/Expander/Expander/Expander.tsx
@@ -190,10 +190,6 @@ interface ExpanderState {
openState: boolean;
}
-/**
- *
- * Hide or show content with always visible title
- */
const Expander = forwardRef(
(props: ExpanderProps, ref: React.Ref) => {
const { id: propId, ...passProps } = props;
diff --git a/src/core/Expander/ExpanderContent/ExpanderContent.tsx b/src/core/Expander/ExpanderContent/ExpanderContent.tsx
index 4f469432e..9625cbc6a 100644
--- a/src/core/Expander/ExpanderContent/ExpanderContent.tsx
+++ b/src/core/Expander/ExpanderContent/ExpanderContent.tsx
@@ -68,10 +68,6 @@ const StyledExpanderContent = styled(BaseExpanderContent)`
${({ theme }) => baseStyles(theme)}
`;
-/**
- *
- * Expander content wrapper, controlled by expander
- */
const ExpanderContent = (props: ExpanderContentProps) => (
{({ suomifiTheme }) => (
diff --git a/src/core/Expander/ExpanderGroup/ExpanderGroup.tsx b/src/core/Expander/ExpanderGroup/ExpanderGroup.tsx
index 13a7b0882..f26be1e0d 100644
--- a/src/core/Expander/ExpanderGroup/ExpanderGroup.tsx
+++ b/src/core/Expander/ExpanderGroup/ExpanderGroup.tsx
@@ -198,11 +198,6 @@ const StyledExpanderGroup = styled(BaseExpanderGroup)`
${({ theme }) => baseStyles(theme)}
`;
-/**
- *
- * Wrapper for multiple expanders with Open/Close All button
- */
-
const ExpanderGroup = forwardRef(
(props: ExpanderGroupProps, ref: React.Ref) => (
diff --git a/src/core/Expander/ExpanderTitle/ExpanderTitle.tsx b/src/core/Expander/ExpanderTitle/ExpanderTitle.tsx
index 5c3f74f33..dff625878 100644
--- a/src/core/Expander/ExpanderTitle/ExpanderTitle.tsx
+++ b/src/core/Expander/ExpanderTitle/ExpanderTitle.tsx
@@ -26,9 +26,9 @@ export interface ExpanderTitleProps extends Omit {
className?: string;
/** Title for Expander */
children?: ReactNode;
- /** Screen reader action label for collapsed expander toggle button. E.g. "open expander". */
+ /** Screen reader action label for collapsed expander toggle button. E.g. "Additional information". */
ariaOpenText: string;
- /** Screen reader action label for expanded expander toggle button. E.g. "close expander". */
+ /** Screen reader action label for expanded expander toggle button. Should usually be the same as `ariaOpenText` */
ariaCloseText: string;
/** Expander title id for screen reader reference in expander toggle button. */
toggleButtonAriaDescribedBy: string;
@@ -99,10 +99,6 @@ const StyledExpanderTitle = styled(BaseExpanderTitle)`
${({ theme }) => expanderTitleBaseStyles(theme)}
`;
-/**
- *
- * Expander title for focusable content and toggle button for content visiblity
- */
const ExpanderTitle = (props: ExpanderTitleProps) => (
{({ suomifiTheme }) => (
diff --git a/src/core/Expander/ExpanderTitleButton/ExpanderTitleButton.tsx b/src/core/Expander/ExpanderTitleButton/ExpanderTitleButton.tsx
index 2cbfe585c..4fdd7bc93 100644
--- a/src/core/Expander/ExpanderTitleButton/ExpanderTitleButton.tsx
+++ b/src/core/Expander/ExpanderTitleButton/ExpanderTitleButton.tsx
@@ -85,10 +85,6 @@ const StyledExpanderTitle = styled(BaseExpanderTitleButton)`
${({ theme }) => expanderTitleButtonBaseStyles(theme)}
`;
-/**
- *
- * Expander title button for static title content and toggle for content visiblity
- */
const ExpanderTitleButton = forwardRef(
(
props: ExpanderTitleButtonProps,
diff --git a/src/core/Form/Checkbox/Checkbox.md b/src/core/Form/Checkbox/Checkbox.md
index f6be8b685..3cbaaad43 100644
--- a/src/core/Form/Checkbox/Checkbox.md
+++ b/src/core/Form/Checkbox/Checkbox.md
@@ -1,88 +1,212 @@
+The `` component is used to mark a value as selected in a form.
+
+Examples:
+
+- [Basic use](/#/Components/Checkbox?id=basic-use)
+- [Hint text](/#/Components/Checkbox?id=hint-text)
+- [Error status](/#/Components/Checkbox?id=error-status)
+- [Default state](/#/Components/Checkbox?id=default-state)
+- [Controlled state](/#/Components/Checkbox?id=controlled-state)
+- [Disabled](/#/Components/Checkbox?id=disabled)
+- [Accessing value with ref](/#/Components/Checkbox?id=accessing-value-with-ref)
+- [Large checkbox](/#/Components/Checkbox?id=large-checkbox)
+- [Checkboxes in group](/#/Components/Checkbox?id=checkboxes-in-group)
+- [Group error status](/#/Components/Checkbox?id=group-error-status)
+- [Optional input](/#/Components/Checkbox?id=optional-input)
+- [Group with a tooltip](/#/Components/Checkbox?id=group-with-a-tooltip)
+
+
+ [Props & methods (Checkbox)](/#/Components/Checkbox?id=props--methods)
+
+
+ [Props & methods (CheckboxGroup)](/#/Components/Checkbox?id=checkboxgroup)
+
+
+### Basic use
+
+```js
+import { Checkbox } from 'suomifi-ui-components';
+
+I accept the terms & conditions;
+```
+
+### Hint text
+
+Use the `hintText` prop to provide additional information about the field
+
+```js
+import { Checkbox } from 'suomifi-ui-components';
+
+
+ I wish to be contacted regularly
+;
+```
+
+### Error status
+
+Toggle the error status of the component using the `status` and `statusText` props. The `statusText` is connected to the `` using `aria-describedby` and read out to screen readers automatically upon change using `aria-live="assertive"`.
+
+```js
+import { Checkbox } from 'suomifi-ui-components';
+
+
+ I accept the terms & conditions
+;
+```
+
+### Default state
+
+The initial state of the component can be set with the `defaultChecked` prop.
+
+```js
+import { Checkbox } from 'suomifi-ui-components';
+
+I accept the terms & conditions;
+```
+
+### Controlled state
+
+The state of the component can be accessed and controlled programmatically using the `checked` prop.
+
+A typical use case involves setting the state manually in the `onClick()` function.
+
+```js
+import { Checkbox } from 'suomifi-ui-components';
+import { useState } from 'react';
+
+const [checked, setChecked] = useState(false);
+
+ {
+ setChecked(newState.checkboxState);
+ }}
+>
+ I wish to be contacted regularly
+;
+```
+
+### Disabled
+
+You can disable the component with the `disabled` prop. A Checkbox could be disabled when the user has not yet performed some other required action.
+
+```js
+import { Checkbox } from 'suomifi-ui-components';
+
+I accept the terms & conditions;
+```
+
+### Accessing value with ref
+
+The value of a Checkbox can be accessed using React ref.
+
+```js
+import { Checkbox } from 'suomifi-ui-components';
+import { useRef } from 'react';
+
+const checkboxRef = useRef();
+
+ console.log(checkboxRef.current.checked)}
+>
+ I accept the terms & conditions
+;
+```
+
+### Large checkbox
+
+Use `variant="large"` on smaller screen sizes.
+
```js
import { Checkbox } from 'suomifi-ui-components';
+
+I accept the terms & conditions;
+```
+
+### Checkboxes in group
+
+Use the `` component to place multiple Checkboxes into a group. The group is rendered as an HTML `;
```
+
+### Props & methods
diff --git a/src/core/Form/Checkbox/CheckboxGroup.tsx b/src/core/Form/Checkbox/CheckboxGroup.tsx
index 731d76531..0faf1ad3f 100644
--- a/src/core/Form/Checkbox/CheckboxGroup.tsx
+++ b/src/core/Form/Checkbox/CheckboxGroup.tsx
@@ -148,9 +148,6 @@ const StyledCheckboxGroup = styled(BaseCheckboxGroup)`
${({ theme }) => baseStyles(theme)}
`;
-/**
- * Use for grouping Checkboxes.
- */
const CheckboxGroup = forwardRef(
(props: CheckboxGroupProps, ref: React.Ref) => {
const { id: propId, ...passProps } = props;
diff --git a/src/core/Form/DateInput/DateInput.md b/src/core/Form/DateInput/DateInput.md
index 60d4e8472..568962af7 100644
--- a/src/core/Form/DateInput/DateInput.md
+++ b/src/core/Form/DateInput/DateInput.md
@@ -1,53 +1,129 @@
-### Default DateInput
+`` is used to input dates. Additionally, you can use the date picker calendar to allow users to select the date.
+
+Examples:
+
+- [Basic use](/#/Components/DateInput?id=basic-use)
+- [Default value](/#/Components/DateInput?id=default-value)
+- [Controlled value](/#/Components/DateInput?id=controlled-value)
+- [Date picker](/#/Components/DateInput?id=date-picker)
+- [MinDate & maxDate](/#/Components/DateInput?id=mindate--maxdate)
+- [Validation](/#/Components/DateInput?id=validation)
+- [Initial focused date in date picker](/#/Components/DateInput?id=initial-focused-date-in-date-picker)
+- [Disabled dates in date picker](/#/Components/DateInput?id=disabled-dates-in-date-picker)
+- [Custom dateAdapter](/#/Components/DateInput?id=custom-dateadapter)
+- [Custom texts for date picker](/#/Components/DateInput?id=custom-texts-for-date-picker)
+- [Accessing value with ref](/#/Components/DateInput?id=accessing-value-with-ref)
+- [Small screen date picker](/#/Components/DateInput?id=small-screen-date-picker)
+- [Hidden label](/#/Components/DateInput?id=hidden-label)
+- [Full width and fixed width](/#/Components/DateInput?id=full-width-and-fixed-width)
+- [Optional input](/#/Components/DateInput?id=optional-input)
+- [Tooltip](/#/Components/DateInput?id=tooltip)
+
+
+ [Props & methods](/#/Components/DateInput?id=props--methods)
+
+
+### Basic use
+
+Always use a `labelText` to label the input.
+
+You must also provide formatting instructions to the user. The recommended way to do this is to use `hintText`.
+
+The `visualPlaceholder` prop is used to apply a placeholder text to the input. For accessibility reasons, do not use placeholders for instructions.
```js
import { DateInput } from 'suomifi-ui-components';
-import React from 'react';
-<>
-
->;
+;
```
-### DateInput with DatePicker
+### Default value
+
+Default value for the input can be set with the `defaultValue` prop.
+
+Note that the value is providen as a string.
```js
import { DateInput } from 'suomifi-ui-components';
-import React from 'react';
-<>
-
->;
+;
```
-### DateInput with DatePicker, smallScreen
+### Controlled value
+
+Use the `value` prop to access and control the input's value programmatically.
+
+A typical use case involves setting the input's value manually in the `onChange()` function.
```js
import { DateInput } from 'suomifi-ui-components';
-import React from 'react';
+import { useState } from 'react';
-<>
-
->;
+const [controlledValue, setControlledValue] = useState('');
+
+ setControlledValue(value)}
+/>;
```
-### DateInput with minDate, maxDate, and change validation
+### Date picker
+
+Use the `datePickerEnabled` prop to enable the date picker calendar.
+
+You can set the language of the calendar with the `language` prop. Finnish (fi), Swedish (sv) and English (en) are available.
+
+```js
+import { DateInput } from 'suomifi-ui-components';
+
+;
+```
+
+### MinDate & maxDate
+
+Use the `minDate` and `maxDate` props to control the available dates in the date picker calendar.
+
+```js
+import { DateInput } from 'suomifi-ui-components';
+
+const minDate = new Date(2023, 1, 2);
+const maxDate = new Date(2024, 11, 31);
+
+;
+```
+
+### Validation
+
+- Use the `onChange()` function to run validation logic and set the `status` and `statusText` props accordingly.
+- `date-fns` is a internal dependency of `suomifi-ui-components` so you can import it for your validations.
+- You can use the `debounce` prop to only run the validation when the user stops typing.
```js
import { DateInput } from 'suomifi-ui-components';
import { isWithinInterval } from 'date-fns';
-import React from 'react';
+import { useState } from 'react';
const minDate = new Date(2023, 1, 2);
const maxDate = new Date(2024, 11, 31);
@@ -58,12 +134,12 @@ const validate = ({ value, date }) => {
setStatusText('');
setStatus('default');
} else if (Number.isNaN(date.valueOf())) {
- setStatusText('Format like D.M.YYYY');
+ setStatusText('Invalid date format');
setStatus('error');
} else if (
!isWithinInterval(date, { start: minDate, end: maxDate })
) {
- setStatusText('Not in date range');
+ setStatusText('Date is not in range');
setStatus('error');
} else if (
isWithinInterval(date, { start: minDate, end: maxDate })
@@ -73,265 +149,201 @@ const validate = ({ value, date }) => {
}
};
-<>
-
->;
+;
```
-### DateInput with initialDate
+### Initial focused date in date picker
+
+You can use the `initialDate` prop to control which date gets focused when the date picker opens.
```js
import { DateInput } from 'suomifi-ui-components';
-import React from 'react';
-<>
-
->;
+;
```
-### DateInput with dates disabled
+### Disabled dates in date picker
+
+Use the `shouldDisableDate()` prop to disable certain dates from the date picker. Disabled dates can still be accessed through keyboard navigation but they are not selectable.
```js
import { DateInput } from 'suomifi-ui-components';
import { isWeekend } from 'date-fns';
-import React from 'react';
-<>
- isWeekend(date)}
- />
->;
+ isWeekend(date)}
+/>;
```
-### DateInput with custom dateAdapter
+### Custom dateAdapter
+
+The `dateAdapter` prop enables custom formatting and parsing for the date selected with the date picker calendar.
```js
import { DateInput } from 'suomifi-ui-components';
import { format, parse } from 'date-fns';
-import React from 'react';
const customDateAdapter = {
format: (date) => format(date, 'y-M-d'),
parse: (value) => parse(value, 'y-M-d', new Date())
};
-<>
-
->;
+;
```
-### DatePicker with custom texts
+### Custom texts for date picker
-```js
-import { DateInput } from 'suomifi-ui-components';
-import React from 'react';
+If you need to customize the texts in the date picker calendar, use the `datePickerTexts` prop.
-<>
-
->;
-```
-
-### Label options
+For a full list of customisable text options, refer to props & methods
```js
import { DateInput } from 'suomifi-ui-components';
-import React from 'react';
-<>
- console.log(event.target.value)}
- labelText="Visible label"
- />
- console.log(event.target.value)}
- labelText="Hidden label"
- labelMode="hidden"
- visualPlaceholder="Has hidden label"
- />
->;
+;
```
-### Hint text
+### Accessing value with ref
+
+The value of a DateInput can be accessed using React ref.
```js
import { DateInput } from 'suomifi-ui-components';
-import React from 'react';
+import { useRef } from 'react';
-const exampleRef = React.createRef();
+const dateInputRef = useRef();
-<>
- console.log(event.target.value)}
- labelText="Date"
- language="en"
- hintText="Use format D.M.YYYY"
- />
->;
+ console.log(dateInputRef.current.value)}
+/>;
```
-### Optional text
+### Small screen date picker
+
+Use the `smallScreen` prop to enable a version of the date picker which is designed for narrower screens.
```js
import { DateInput } from 'suomifi-ui-components';
-import React from 'react';
-<>
-
->;
+;
```
-### Ref
+### Hidden label
+
+Label can be visually hidden with the `labelMode="hidden"` prop.
```js
import { DateInput } from 'suomifi-ui-components';
import React from 'react';
-const exampleRef = React.createRef();
-
-<>
- {
- console.log(exampleRef.current);
- }}
- />
->;
+ console.log(event.target.value)}
+ labelText="Beginning date"
+ labelMode="hidden"
+/>;
```
-### Statuses
+### Full width and fixed width
-```js
-import { DateInput } from 'suomifi-ui-components';
+You can use the `fullWidth` prop to make the input take all available horizontal space.
+
+You can use `wrapperProps` to set inline styles for the input.
+```js
+import { DateInput, Button } from 'suomifi-ui-components';
<>
console.log(event.target.value)}
- labelText="Default"
+ labelText="Beginning date"
+ hintText="Use format D.M.YYYY"
language="en"
datePickerEnabled
+ fullWidth
/>
+
-
>;
```
-### DateInput with changing error status
+### Optional input
-```js
-import { DateInput, Button } from 'suomifi-ui-components';
+Suomi.fi inputs are required by default, but can be marked optional using the `optionalText` property.
-const [errorState, setErrorState] = React.useState(false);
-const simplifiedRegex = /[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,4}/g;
-const statusText = errorState
- ? 'You entered invalid data'
- : undefined;
-const status = errorState ? 'error' : 'default';
+```js
+import { DateInput } from 'suomifi-ui-components';
{
- const isValid = simplifiedRegex.test(value);
- setErrorState(!isValid);
- }}
+ optionalText="optional"
+ fullWidth
/>;
```
-### DateInput with fixed width or full width
+### Tooltip
-```js
-import { DateInput, Button } from 'suomifi-ui-components';
-<>
-
+A `` component can be used with DateInput to provide additional information.
-
->;
-```
-
-### DateInput with debounced onChange event
-
-```js
-import { DateInput } from 'suomifi-ui-components';
-
-<>
- console.log(change)}
- debounce={800}
- />
->;
-```
+Do not use Tooltip for formatting instructions. Tooltip can be used for other nice-to-know information.
-### DateInput with tooltip
+For instructions regarding how to ensure your Tooltip is accessible, please refer to the [Tooltip documentation](/#/Components/Tooltip).
```js
import {
@@ -341,21 +353,28 @@ import {
Text
} from 'suomifi-ui-components';
-<>
-
-
- Date
-
- Example text
-
- }
- />
->;
+const labelText = 'Beginning date';
+
+
+
+ What happens on the beginning date?
+
+
+ Your service will begin on the selected date during the early
+ morning hours, before 9.00
+
+
+ }
+/>;
```
+
+### Props & methods
diff --git a/src/core/Form/DateInput/DateInput.tsx b/src/core/Form/DateInput/DateInput.tsx
index dfd61d17b..9924d9011 100644
--- a/src/core/Form/DateInput/DateInput.tsx
+++ b/src/core/Form/DateInput/DateInput.tsx
@@ -453,14 +453,6 @@ const StyledDateInput = styled(
${({ theme }) => baseStyles(theme)}
`;
-/**
- *
- * Use for user inputting date.
- * Can be used as an input field or with an additional DatePicker.
- *
- * Props other than specified explicitly are passed on to underlying input element. For example defaultValue and onClick.
- * @component
- */
const DateInput = forwardRef(
(props: DateInputProps, ref: React.Ref) => {
const { id: propId, ...passProps } = props;
diff --git a/src/core/Form/HintText/HintText.md b/src/core/Form/HintText/HintText.md
index c81719206..6aa968eef 100644
--- a/src/core/Form/HintText/HintText.md
+++ b/src/core/Form/HintText/HintText.md
@@ -1,32 +1,42 @@
-HintText is a component that generates an accessible hint text for an adjacent element. Give the ID of the HintText as an `aria-describedby` value to the related component. Applicable form components in the library already have HintText as an integral part.
+The `` component creates an accessible instruction text for an adjacent element.
+
+Under the hood, the `suomifi-ui-components` library uses this component extensively in form components.
+
+Examples:
+
+- [Basic use](/#/Components/HintText?id=basic-use)
+
+
+ [Props & methods](/#/Components/HintText?id=props--methods)
+
+
+### Basic use
+
+Provide the id of the HintText as an `aria-describedby` value to the related component.
```js
-import React from 'react';
import { HintText } from 'suomifi-ui-components';
-This is a hint regarding an adjacent input;
+
+
+
+ Please enter your first name
+
+
+
;
```
+### Integrated hint text
+
+Many components allow you to provide `hintText` as a prop.
+
```js
-import React from 'react';
-import { HintText } from 'suomifi-ui-components';
+import { TextInput } from 'suomifi-ui-components';
-<>
-
-
-
- This is a hint regarding an adjacent input
-
-
-
->;
+;
```
+
+### Props & methods
diff --git a/src/core/Form/Label/Label.md b/src/core/Form/Label/Label.md
index 1d8a3225d..6cd95921a 100644
--- a/src/core/Form/Label/Label.md
+++ b/src/core/Form/Label/Label.md
@@ -1,53 +1,72 @@
-Label is an accessible label component to use with custom input elements. Applicable form components in the library already have Label as an integral part.
+`;
```
-For frameworks where its internal link component is used as a wrapper for the actual link, for example NextJS, the following approach can be used:
-
-```jsx static
-
-
- Inbox
-
-
-```
+### Small screen
-### Small screen variant
+- Apply `variant="smallScreen"` to get mobile screen styles. This includes a toggle button to show/hide the menu.
+- Provide a descriptive `smallScreenExpandButtonText` for the toggle button.
+- Control the menu's initially opened state with the `initiallyExpanded` prop.
```js
import {
@@ -116,13 +126,80 @@ const Comp = (props) => {
Sent
+
+
+ Drafts
+
+ 3
+
+
+
+
+ console.log('Nav item clicked')}
+ role="button"
+ tabIndex="0"
+ >
+ Settings
+
+
- New Message
+ Devices
+
+
+
+
;
+```
+
+### Disabled items
+
+Apply the `disabled` prop to an individual ServiceNavigationItem to disable the item.
+
+Set `role="link"` and `aria-disabled` for the RouterLink to allow screen reader focusability.
+
+```js
+import {
+ ServiceNavigation,
+ ServiceNavigationItem,
+ RouterLink,
+ ExternalLink,
+ StaticChip
+} from 'suomifi-ui-components';
+
+const CustomButton = (props) => {
+ const { children, ...passProps } = props;
+ return