/* eslint react/no-multi-comp: 0, react/prop-types: 0 */ import React from 'react'; import { PrismCode } from 'react-prism'; import Helmet from 'react-helmet'; import OverviewExample from '../examples/InputGroupOverview'; const OverviewExampleSource = require('!!raw!../examples/InputGroupOverview'); import AddonExample from '../examples/InputGroupAddon'; const AddonExampleSource = require('!!raw!../examples/InputGroupAddon'); import AddonSizingExample from '../examples/InputGroupSizing'; const AddonSizingExampleSource = require('!!raw!../examples/InputGroupSizing'); import ButtonExample from '../examples/InputGroupButton'; const ButtonExampleSource = require('!!raw!../examples/InputGroupButton'); import ButtonShorthandExample from '../examples/InputGroupButtonShorthand'; const ButtonShorthandExampleSource = require('!!raw!../examples/InputGroupButtonShorthand'); export default class InputGroupPage extends React.Component { constructor(props) { super(props); this.toggle = this.toggle.bind(this); this.state = { dropdownOpen: false }; } toggle() { this.setState({ dropdownOpen: !this.state.dropdownOpen }); } render() { return (
{OverviewExampleSource}
{`InputGroup.propTypes = {
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
size: PropTypes.string,
className: PropTypes.string
};
InputGroupAddOn.propTypes = {
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
className: PropTypes.string
};
InputGroupButton.propTypes = {
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
children: PropTypes.node,
groupClassName: PropTypes.string, // only used in shorthand
groupAttributes: PropTypes.object, // only used in shorthand
className: PropTypes.string
};`}
{AddonExampleSource}
{AddonSizingExampleSource}
{ButtonExampleSource}
Button shorthand is a convenience method for adding just a button. It is triggered when only a single string
is the child. A Button will be created and all of the props will be passed to it with the exception of
groupClassName and groupAttributes, which are used to added classes and attributes
to the wrapping container. This means you can add your onClick and other handlers directly to
InputGroupButton. If you want your string to not be wrapped in a button, then you really want to
use InputGroupAddon (see Addons above for that).
{ButtonShorthandExampleSource}