Skip to main content

What are you looking for?

Try searching for…

Components

Validation message

Validation message is used to display feedback related to the validation of user input, such as error messages or warnings in forms.

HTML

Press Enter to start editing
Unable to parse html
const PreviewEn = () => {
  return <ValidationMessage>This is a validation message.</ValidationMessage>;
};

render(<PreviewEn />)

Usage

Use the class name ds-validation-message to style a validation message.

CSS variables and data attributes

Sizes are controlled with data-size and colors with data-color. The component will inherit from the closest parent where these are set.

CSS Variables
NameValue
--dsc-validation-message-icon-urlurl("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M7.74 2.47a.75.75 0 0 1 .53-.22h7.46a.75.75 0 0 1 .53.22l5.27 5.27c.14.14.22.33.22.53v7.46a.75.75 0 0 1-.22.53l-5.27 5.27a.75.75 0 0 1-.53.22H8.27a.75.75 0 0 1-.53-.22l-5.27-5.27a.75.75 0 0 1-.22-.53V8.27a.75.75 0 0 1 .22-.53zm1.29 5.5a.75.75 0 0 0-1.06 1.06L10.94 12l-2.97 2.97a.75.75 0 1 0 1.06 1.06L12 13.06l2.97 2.97a.75.75 0 1 0 1.06-1.06L13.06 12l2.97-2.97a.75.75 0 0 0-1.06-1.06L12 10.94z'/%3E%3C/svg%3E")
--dsc-validation-message-icon-sizevar(--ds-size-7)
--dsc-validation-message-spacingvar(--ds-size-2)
--dsc-validation-message-colorvar(--ds-color-danger-text-subtle)

No relevant data attributes found.

Example

React

asChild
Description

Change the default rendered element for the one passed as a child, merging their props and behavior.

Type
boolean
Default
false
NameTypeDefaultDescription
asChildbooleanfalse

Change the default rendered element for the one passed as a child, merging their props and behavior.

Edit this page on github.com (opens in a new tab)