961 B37 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import type {ReactNode} from 'react';
9import type {ReactProps} from './utils';
10
11import * as stylex from '@stylexjs/stylex';
12
13const styles = stylex.create({
14 tag: {
15 backgroundColor: 'var(--badge-background)',
16 border: '1px solid var(--button-border)',
17 borderRadius: 'var(--tag-corner-radius, 2px)',
18 color: 'var(--badge-foreground)',
19 padding: '2px 4px',
20 fontFamily: 'var(--font-family)',
21 fontSize: '11px',
22 lineHeight: '16px',
23
24 textOverflow: 'ellipsis',
25 maxWidth: '200px',
26 whiteSpace: 'nowrap',
27 overflow: 'hidden',
28 },
29});
30
31export function Tag({
32 xstyle,
33 ...rest
34}: {children: ReactNode; xstyle?: stylex.StyleXStyles} & ReactProps<HTMLSpanElement>) {
35 return <span {...stylex.props(styles.tag, xstyle)} {...rest} />;
36}
37