import * as React from "react"; import * as System from "~/components/system"; import * as Constants from "~/common/constants"; import Group from "~/components/system/Group"; import SystemPage from "~/components/system/SystemPage"; import ViewSourceLink from "~/components/system/ViewSourceLink"; import CodeBlock from "~/components/system/CodeBlock"; const TAB_GROUP_TWO = [ { value: "1", label: "Capricorn" }, { value: "2", label: "Aquarius" }, ]; const TAB_GROUP_THREE = [ { value: "1", label: "Capricorn" }, { value: "2", label: "Aquarius" }, { value: "3", label: "Pisces" }, ]; const TAB_GROUP_FOUR = [ { value: "1", label: "Capricorn" }, { value: "2", label: "Aquarius" }, { value: "3", label: "Pisces" }, { value: "4", label: "Aries" }, ]; export default class SystemPageTabs extends React.Component { state = { default: "1", eight: "1", nine: "3", ten: "1", }; _handleChange = (e) => { this.setState({ [e.target.name]: e.target.value }); }; render() { return ( Tabs

The TabGroup component is used to allow the users to switch between views.


Imports

Import React and the TabGroup Component.

{`import * as React from 'react'; import { TabGroup } from 'slate-react-system';`}

Usage

Define the tab group values and labels.
{`const TAB_GROUP_TWO = [ { value: '1', label: 'Capricorn' }, { value: '2', label: 'Aquarius' }, ]; const TAB_GROUP_THREE = [ { value: '1', label: 'Capricorn' }, { value: '2', label: 'Aquarius' }, { value: '3', label: 'Pisces' }, ];`}
Declare the TabGroup component.
{`class ExampleOne extends React.Component { state = { exampleOne: '1' } _handleChange = e => this.setState( { [e.target.name]: e.target.value } ); render() { return( ) } } class ExampleTwo extends React.Component { state = { exampleTwo: '3' } _handleChange = e => this.setState( { [e.target.name]: e.target.value } ); render() { return( ) } }`}

Output




Accepted React Properties

onChange ), b: "function", c: "null", d: "Function called upon an onChange event", }, { id: 2, a: ( value ), b: "boolean", c: "false", d: "The value that is currently selected. Can be used to assign default values as well", }, { id: 3, a: ( options ), b: "Array", c: "[]", d: "An array of options, each of which has a value and a label", }, { id: 4, a: "name", b: "string", c: "null", d: "Input name", }, ], }} />
); } }