Skip to content

Commit f231f2c

Browse files
committed
Add prop types for Tag
1 parent a9503cc commit f231f2c

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export type { SettingsProps } from './settings'
4848
export { default as Slider } from './slider'
4949
export { default as Table } from './table'
5050
export { default as TableCaption } from './table-caption'
51-
export { default as Tag } from './tag'
51+
export { default as Tag, TagProps } from './tag'
5252
export { default as Toggle } from './toggle'
5353
export { default as Tray } from './tray'
5454
export { formatDate, getScrollbarWidth, useScrollbarClass } from './utils'

src/tag.js renamed to src/tag.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import React from 'react'
2-
import { Box } from 'theme-ui'
2+
import { Box, BoxProps, ThemeUIStyleObject } from 'theme-ui'
33

4-
const Tag = ({ label, value, sx, children, ...props }) => {
4+
export interface TagProps extends BoxProps {
5+
label: BoxProps['aria-label']
6+
value: BoxProps['aria-checked']
7+
sx?: ThemeUIStyleObject & {
8+
color?: string // ThemeUIStyleObject doesn't have a color property
9+
}
10+
}
11+
const Tag = ({ label, value, sx, children, ...props }: TagProps) => {
512
const color = sx && sx.color ? sx.color : 'primary'
613
const isClickable = props && (props.onClick || props.onDoubleClick)
714

0 commit comments

Comments
 (0)