react-material-web-components
Version:
React Wrapper for Material Design Components
35 lines (29 loc) • 696 B
JavaScript
import React, {PureComponent} from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
class SwitchLabel extends PureComponent {
static displayName = 'SwitchLabel'
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
tagName: PropTypes.string,
}
static defaultProps = {
tagName: 'label',
}
render() {
const {
children,
className,
tagName,
...otherProps,
} = this.props
const cssClasses = classNames('mdc-switch-label', className)
return React.createElement(
tagName,
{...otherProps, className: cssClasses},
children
)
}
}
export default SwitchLabel