Skip to content

Commit 7e976f9

Browse files
authored
[aksel.nav.no] Add example of ErrorMessage with icon (#3476)
1 parent db828bd commit 7e976f9

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

@navikt/core/react/src/typography/ErrorMessage.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export interface ErrorMessageProps
1616
* Error text.
1717
*/
1818
children: React.ReactNode;
19-
2019
/**
2120
* Render a triangular warning icon.
2221
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { ErrorMessage, VStack } from "@navikt/ds-react";
2+
import { withDsExample } from "@/web/examples/withDsExample";
3+
4+
const Example = () => {
5+
const exampeText = "Du må fylle ut tekstfeltet før innsending.";
6+
7+
return (
8+
<VStack gap="5">
9+
<ErrorMessage showIcon>{exampeText}</ErrorMessage>
10+
11+
<ErrorMessage showIcon size="small">
12+
{exampeText}
13+
</ErrorMessage>
14+
</VStack>
15+
);
16+
};
17+
18+
// EXAMPLES DO NOT INCLUDE CONTENT BELOW THIS LINE
19+
export default withDsExample(Example, { variant: "full" });
20+
21+
/* Storybook story */
22+
export const Demo = {
23+
render: Example,
24+
};
25+
26+
export const args = {
27+
index: 1,
28+
};

0 commit comments

Comments
 (0)