Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="root"></div>
              
            
!

CSS

              
                
              
            
!

JS

              
                const { HashRouter, Switch, Route, Redirect, Link, matchPath, withRouter } = ReactRouterDOM; const Tabs = withRouter(({ items }) => ( <div className="tabs"> <ul role="tablist" aria-orientation="horizontal" className="tabs-list"> {/* We loop through the "items" and create tabs for each */} {items.map((item) => ( <li className="tabs-list__item" key={`tab-${item.name}`}> <Link to={item.route} className="tabs-list__tab" > {item.name} </Link> </li> ))} </ul> {/* Tab content - we use a Switch to only show one tab at a time */} <Switch> {/* We loop through the "items" and create routes to correspond to each tab */} {items.map((item) => ( <Route key={item.id} path={`/${item.route}`} render={item.render} /> ))} {/* We can have a Redirect route to ensure we always have an active route */} <Route render={() => <Redirect to={items[0] ? items[0].route : '/'} />} /> </Switch> </div> )); function App() { return ( <HashRouter> <Tabs items={[ { id: 'id1', name: 'Tab #1', route: 'id1', render: () => ( <div className="tab-content"> Depths burying snare value law merciful value snare society eternal-return decieve aversion. Holiest virtues pious war depths noble inexpedient against endless ultimate. Merciful disgust convictions grandeur abstract battle gains revaluation fearful inexpedient right holiest faithful battle. Merciful depths decrepit intentions virtues salvation war ultimate. Sea transvaluation virtues suicide battle against victorious. </div> ) }, { id: 'id2', name: 'Tab #2', route: 'id2', render: () => ( <div className="tab-content"> Ideal overcome free burying grandeur aversion. Dead morality self right superiority passion virtues hope society play of snare grandeur. Good oneself burying law good ultimate burying. Play justice snare holiest noble sea reason marvelous right. </div> ) }, { id: 'id3', name: 'Tab #3', route: 'id3', render: () => ( <div className="tab-content"> Inexpedient gains prejudice aversion pious snare noble ocean ocean overcome self ubermensch prejudice philosophy. Ocean strong sea burying reason ultimate burying spirit. Pious christianity decieve endless abstract decrepit abstract. Ocean burying depths evil horror suicide mountains fearful depths christianity disgust gains horror. Self marvelous passion faith against grandeur. </div> ) } ]} /> </HashRouter> ); } ReactDOM.render(<App />, document.getElementById('root'));
              
            
!
999px

Console