Author SHA1 Message Date
Aksel Mini fea90c95c8 💄 Match error text color to the danger profile
Use the profile red directly for error messages so text and border
always match, even if the danger token is overridden per theme.
2026-09-05 14:20:00 +02:00
Aksel Mini 885df0a2ff 🐛 Strengthen TextField error border
Widen the error ring to 2px so invalid fields are visible at a glance
in dense forms.
2026-09-05 11:45:00 +02:00
9 changed files with 8 additions and 125 deletions

No files matched your search

-14
View File
@@ -4,7 +4,6 @@ import {
Alert,
BodyShort,
Button,
Chip,
Heading,
Modal,
TextField,
@@ -87,19 +86,6 @@ export function App() {
</Accordion>
</section>
<section className="example">
<Heading level="2" size="medium">
Chip
</Heading>
<div className="example__preview">
<Chip>Filter</Chip>
<Chip variant="action">Oslo</Chip>
<Chip removable onDelete={() => console.log("Slettet")}>
Fjernbar
</Chip>
</div>
</section>
<section className="example">
<Heading level="2" size="medium">
Modal
+1 -1
View File
@@ -2,7 +2,7 @@
## Unreleased
- :sparkles: Add Chip styles.
- :bug: Strengthen TextField error styling with a wider error ring and matching error text color.
## 0.2.0
-50
View File
@@ -1,50 +0,0 @@
/**
* Chip
*/
.navds-chip {
display: inline-flex;
align-items: center;
gap: var(--a-spacing-1);
padding: var(--a-spacing-1) var(--a-spacing-3);
border: 1px solid var(--a-border-default);
border-radius: var(--a-border-radius-full);
background-color: var(--a-bg-default);
color: var(--a-text-default);
font-family: var(--a-font-family);
font-size: var(--a-font-size-xs);
}
.navds-chip--action {
border-color: var(--a-border-action);
background-color: var(--a-surface-action);
color: var(--a-text-on-action);
}
.navds-chip--action:hover {
background-color: var(--a-surface-action-hover);
}
.navds-chip--removable {
padding-right: var(--a-spacing-1);
}
.navds-chip__delete {
display: inline-flex;
align-items: center;
padding: 2px;
border: none;
border-radius: var(--a-border-radius-full);
background-color: transparent;
color: inherit;
cursor: pointer;
}
.navds-chip__delete:hover {
background-color: rgb(35 38 42 / 15%);
}
.navds-chip:focus-within {
outline: 2px solid var(--a-border-focus);
outline-offset: 2px;
}
-1
View File
@@ -6,4 +6,3 @@
@import "./alert.css";
@import "./accordion.css";
@import "./modal.css";
@import "./chip.css";
+7 -1
View File
@@ -51,6 +51,12 @@
box-shadow: 0 0 0 1px var(--a-border-danger);
}
/* Increase the error ring so it reads at a glance on light backgrounds. */
.navds-text-field--error {
box-shadow: 0 0 0 2px #c30000;
border-color: #c30000;
}
.navds-form-field__error {
display: flex;
align-items: center;
@@ -58,7 +64,7 @@
margin: 0;
font-size: var(--a-font-size-xs);
font-weight: var(--a-font-weight-bold);
color: var(--a-icon-danger);
color: #c30000;
}
.navds-sr-only {
-4
View File
@@ -1,9 +1,5 @@
# Changelog
## Unreleased
- :sparkles: Add Chip component with neutral and action variants.
## 0.2.0
- Add Accordion and Modal components.
-50
View File
@@ -1,50 +0,0 @@
import { forwardRef } from "react";
import type { HTMLAttributes, MouseEventHandler, ReactNode } from "react";
import { XMarkIcon } from "@navikt/aksel-icons";
import { cn } from "../util/cn";
export interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
/**
* Chip variant.
* @default "neutral"
*/
variant?: "neutral" | "action";
/**
* Renders a delete button next to the label.
* @default false
*/
removable?: boolean;
/** Called when the delete button is clicked. Requires `removable`. */
onDelete?: MouseEventHandler<HTMLButtonElement>;
children: ReactNode;
}
export const Chip = forwardRef<HTMLSpanElement, ChipProps>(function Chip(
{ variant = "neutral", removable = false, onDelete, className, children, ...rest },
ref,
) {
return (
<span
ref={ref}
className={cn(
"navds-chip",
`navds-chip--${variant}`,
removable && "navds-chip--removable",
className,
)}
{...rest}
>
<span className="navds-chip__label">{children}</span>
{removable ? (
<button
type="button"
className="navds-chip__delete"
aria-label="Slett"
onClick={onDelete}
>
<XMarkIcon />
</button>
) : null}
</span>
);
});
-2
View File
@@ -1,2 +0,0 @@
export { Chip } from "./Chip";
export type { ChipProps } from "./Chip";
-2
View File
@@ -12,5 +12,3 @@ export { Accordion, AccordionItem } from "./accordion";
export type { AccordionProps, AccordionItemProps } from "./accordion";
export { Modal } from "./modal";
export type { ModalProps } from "./modal";
export { Chip } from "./chip";
export type { ChipProps } from "./chip";