mdc-react
Version:
Material Components for the web implemented in React
21 lines (17 loc) • 470 B
JSX
import PropTypes from 'prop-types';
export default function CharacterCounter({
value = 0,
maxValue,
...props
}) {
return (
<div className="mdc-text-field-character-counter" {...props}>
{value + (maxValue ? ` / ${maxValue}` : '')}
</div>
);
}
CharacterCounter.displayName = 'MDCTextFieldCharacterCounter';
CharacterCounter.propTypes = {
value: PropTypes.number,
maxValue: PropTypes.number
};