box-ui-elements
Version:
Box UI Elements
27 lines (21 loc) • 655 B
Flow
// @flow
import * as React from 'react';
import Tooltip from '../tooltip';
import LabelPrimitive from './LabelPrimitive';
type Props = {
children: React.Node,
labelContent: React.Node,
labelElProps?: React.Element<'label'>,
tooltip?: React.Node,
};
const StandardLabel = ({ children, labelContent, labelElProps, tooltip }: Props) => {
const label = <LabelPrimitive labelContent={labelContent} labelElProps={labelElProps}>{children}</LabelPrimitive>;
return tooltip ? (
<Tooltip position="top-right" text={tooltip}>
{label}
</Tooltip>
) : (
label
);
};
export default StandardLabel;