Feedback component can be used to give more information to the user about the input field. It can be used to give a hint about the input field or to give an error message.
The feedback component comes in four variants. The info variant is used to give information to the user, the error variant is used to give an error message, the warning variant is used to give a warning message, and the success variant is used to give a success message.
The feedback component comes with a subtle variant. The subtle variant is used to give a subtle message to the user.
The feedback component comes in two sizes: small, and large. The default size is sm.
The feedback component can have a custom icon. The icon can be added by using the icon slot.
import { DapDSFeedback } from 'dap-design-system'
import { DapDSFeedbackReact } from 'dap-design-system/react'
For optimal bundle sizes, use the tree-shakeable import syntax:
import { DapDSFeedback } from 'dap-design-system/components'
| Property | Type | Default | Description |
|---|---|---|---|
feedback | string | The feedback message. | |
feedbackSize | 'negative', 'positive' , 'warning' | The type of the feedback. | |
feedbackSubtle | boolean | The weight of the feedback. | |
feedbackNoMargin | boolean | Removes the margins around the feedback. | |
feedbackId | string | The id of the feedback. |
| Name | Description |
|---|---|
icon | The custom icon of the feedback. |
(default) | The text of the feedback. |
No custom events available.
| Part Name | Description |
|---|---|
base | The main feedback container. |
icon | The icon of the feedback. |
text | The text of the feedback. |
You can style CSS parts using the ::part() pseudo-element selector:
/* Target a specific part */
.my-custom-dap-ds-feedback::part(base) {
/* Your custom styles */
}
/* Target multiple parts */
.my-custom-dap-ds-feedback::part(base),
.my-custom-dap-ds-feedback::part(icon) {
/* Shared styles */
}
Example usage:
<dap-ds-feedback class="my-custom-dap-ds-feedback">
Feedback message
</dap-ds-feedback>
.my-custom-dap-ds-feedback::part(base) {
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
CSS parts allow you to style internal elements of the component while maintaining encapsulation. Learn more in our styling guide.
| Property Name | Description |
|---|---|
--dds-feedback-spacing | The spacing around the feedback component. (default: var(--dds-spacing-200)) |
--dds-feedback-color | The text color of the feedback. (default: var(--dds-text-positive-subtle)) |
--dds-feedback-font-size | The font size of the feedback. (default: var(--dds-font-sm)) |
--dds-feedback-font-weight | The font weight of the feedback. (default: var(--dds-font-weight-bold)) |
--dds-feedback-icon-fill | The fill color of the feedback icon. (default: var(--dds-icon-positive-subtle)) |
--dds-feedback-icon-spacing | The spacing between the icon and text. (default: var(--dds-spacing-100)) |
--dds-feedback-color-warning | The text color for warning feedback. (default: var(--dds-text-neutral-base)) |
--dds-feedback-color-positive | The text color for positive feedback. (default: var(--dds-text-positive-subtle)) |
--dds-feedback-color-negative | The text color for negative feedback. (default: var(--dds-text-negative-subtle)) |
--dds-feedback-icon-fill-warning | The icon fill color for warning feedback. (default: var(--dds-icon-informative-subtle)) |
--dds-feedback-icon-fill-positive | The icon fill color for positive feedback. (default: var(--dds-icon-positive-subtle)) |
--dds-feedback-icon-fill-negative | The icon fill color for negative feedback. (default: var(--dds-icon-negative-subtle)) |
CSS custom properties (CSS variables) can be set directly on the component or in your stylesheet:
Method 1: Inline styles (Quick customization)
<dap-ds-feedback
style="--dds-feedback-spacing: value; --dds-feedback-color: value;">
Feedback message
</dap-ds-feedback>
Method 2: CSS classes (Reusable styles)
.my-custom-dap-ds-feedback {
--dds-feedback-spacing: value;
--dds-feedback-color: value;
--dds-feedback-font-size: value;
}
<dap-ds-feedback class="my-custom-dap-ds-feedback">
Feedback message
</dap-ds-feedback>
Method 3: Global theme customization
/* Apply to all instances */
dap-ds-feedback {
--dds-feedback-spacing: value;
--dds-feedback-color: value;
}
CSS custom properties inherit through the Shadow DOM, making them perfect for theming. Changes apply immediately without rebuilding.