Cookie Consent Ready
Cookie consent component informs users about cookie usage. This banner is shown when they visit a website or an application for the first time.
Properties #
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
accessibleLabel | accessible-label | Adds accessible label for the cookie consent ok button. | string | "Hyväksyn evästeiden käytön" |
theme | theme | Theme of the cookie consent banner. | "" | "default" | "turva" | "" |
Events #
Event | Description | Type |
---|---|---|
duetCookieConsent | Emitted when the consent button has been clicked. | CustomEvent<{ component: "duet-cookie-consent"; }> |
Usage #
This section includes guidelines for designers and developers about the usage of this component in different contexts.
When to use #
- When you need to inform users about cookie usage.
- Make sure that cookie consent is the first item in the page tab order.
- If your page has a chat button in lower right corner, keep the chat button hidden until cookie consent has been accepted and removed from the DOM.
When not to use #
- For any other usage except informing about cookie usage.
Accessibility #
This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.
- Always make sure that cookie consent is the first item in the page tab order. Place it before header component in the HTML.
- Always provide
accessibleLabel
property for assistive technology to replace the visible “OK” text in the action button. - When providing a “read more” link, it’s required to give some additional information to users of assistive technology by using visually hidden component.
- Cookie Consent additionally uses
tabindex="0"
to make it possible to access it using tab key or programmatically move focus to it.
Additional considerations #
- If your page has a chat button in lower right corner, keep the chat button hidden until cookie consent has been accepted and removed from the DOM.
Integration
For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.
Tutorials
Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:
Building Layouts
TutorialsUsing CLI Tools
TutorialsCreating Custom Patterns
TutorialsServer Side Rendering
TutorialsSharing Prototypes
TutorialsUsage With Markdown
Troubleshooting
If you experience any issues while using a component, please head over to the Support page for more guidelines and help.