diff --git a/packages/components/tag/src/Tag.stories.tsx b/packages/components/tag/src/Tag.stories.tsx
index 9a0fe3afc..af3582dcd 100644
--- a/packages/components/tag/src/Tag.stories.tsx
+++ b/packages/components/tag/src/Tag.stories.tsx
@@ -24,6 +24,7 @@ const intents: TagProps['intent'][] = [
'danger',
'info',
'neutral',
+ 'surface',
]
const designs: TagProps['design'][] = ['filled', 'outlined', 'tinted']
@@ -43,11 +44,17 @@ export const Intent: StoryFn = _args => (
{designs.map(design => (
- {intents.map(intent => (
-
- {intent} tag
-
- ))}
+ {intents.map(intent => {
+ if (design !== 'filled' && intent === 'surface') {
+ return N/A
+ }
+
+ return (
+
+ {intent} tag
+
+ )
+ })}
))}
diff --git a/packages/components/tag/src/Tag.styles.tsx b/packages/components/tag/src/Tag.styles.tsx
index 08f5b4b03..ebecfcdb6 100644
--- a/packages/components/tag/src/Tag.styles.tsx
+++ b/packages/components/tag/src/Tag.styles.tsx
@@ -28,7 +28,18 @@ export const tagStyles = cva(
*/
intent: makeVariants<
'intent',
- ['main', 'support', 'accent', 'basic', 'success', 'alert', 'info', 'neutral', 'danger']
+ [
+ 'main',
+ 'support',
+ 'accent',
+ 'basic',
+ 'success',
+ 'alert',
+ 'info',
+ 'neutral',
+ 'danger',
+ 'surface',
+ ]
>({
main: [],
support: [],
@@ -39,6 +50,7 @@ export const tagStyles = cva(
danger: [],
info: [],
neutral: [],
+ surface: [],
}),
},
compoundVariants: [...filledVariants, ...outlinedVariants, ...tintedVariants],
diff --git a/packages/components/tag/src/Tag.tsx b/packages/components/tag/src/Tag.tsx
index 873642144..d6acc1d55 100644
--- a/packages/components/tag/src/Tag.tsx
+++ b/packages/components/tag/src/Tag.tsx
@@ -3,7 +3,7 @@ import { forwardRef, type PropsWithChildren } from 'react'
import { tagStyles, type TagStylesProps } from './Tag.styles'
-export interface TagProps
+interface BaseTagProps
extends PropsWithChildren>,
TagStylesProps {
/**
@@ -12,6 +12,21 @@ export interface TagProps
asChild?: boolean
}
+interface FilteredDesignIntent<
+ Design extends TagProps['design'],
+ K extends TagStylesProps['intent'] | never = never,
+> {
+ design?: Design
+ intent?: Exclude
+}
+
+type ValidTagDesignIntent =
+ | FilteredDesignIntent<'tinted', 'surface'>
+ | FilteredDesignIntent<'outlined', 'surface'>
+ | FilteredDesignIntent<'filled'>
+
+export type TagProps = BaseTagProps & ValidTagDesignIntent
+
export const Tag = forwardRef(
({ design = 'filled', intent = 'basic', asChild, className, ...others }, ref) => {
const Component = asChild ? Slot : 'span'
diff --git a/packages/components/tag/src/variants/filled.ts b/packages/components/tag/src/variants/filled.ts
index 55b1fd933..b66d2263f 100644
--- a/packages/components/tag/src/variants/filled.ts
+++ b/packages/components/tag/src/variants/filled.ts
@@ -46,4 +46,9 @@ export const filledVariants = [
design: 'filled',
class: tw(['bg-neutral', 'text-on-neutral']),
},
+ {
+ intent: 'surface',
+ design: 'filled',
+ class: tw(['bg-surface', 'text-on-surface']),
+ },
] as const