addons/components/Tag.tsxblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import type {ReactNode} from 'react';
b69ab319import type {ReactProps} from './utils';
b69ab3110
b69ab3111import * as stylex from '@stylexjs/stylex';
b69ab3112
b69ab3113const styles = stylex.create({
b69ab3114 tag: {
b69ab3115 backgroundColor: 'var(--badge-background)',
b69ab3116 border: '1px solid var(--button-border)',
b69ab3117 borderRadius: 'var(--tag-corner-radius, 2px)',
b69ab3118 color: 'var(--badge-foreground)',
b69ab3119 padding: '2px 4px',
b69ab3120 fontFamily: 'var(--font-family)',
b69ab3121 fontSize: '11px',
b69ab3122 lineHeight: '16px',
b69ab3123
b69ab3124 textOverflow: 'ellipsis',
ab83ad325 maxWidth: '200px',
b69ab3126 whiteSpace: 'nowrap',
b69ab3127 overflow: 'hidden',
b69ab3128 },
b69ab3129});
b69ab3130
b69ab3131export function Tag({
b69ab3132 xstyle,
b69ab3133 ...rest
b69ab3134}: {children: ReactNode; xstyle?: stylex.StyleXStyles} & ReactProps<HTMLSpanElement>) {
b69ab3135 return <span {...stylex.props(styles.tag, xstyle)} {...rest} />;
b69ab3136}