0.1.14 • Published 3 years ago

senior-fe-challenge v0.1.14

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

senior-fe-challenge

Test Challenge: Tabulator Component

Install

npm i senior-fe-challenge

Controlled/Uncontrolled

The component gives the possibility to function as controlled or uncontrolled.

Controlled

  import { Tab, TabPane } from 'senior-fe-challenge'
  
  function App() {
  
    const [activeTab, setactiveTab] = useState('First Pane');
    
    const onActiveChange = (e: any) => {
        setactiveTab(e);
    }
    
    return(
      <Tab active={activeTab} onActiveChange={onActiveChange}> 
        <TabPane title="First Pane">
          First Pane Body
        </TabPane>
        <TabPane title="Second Pane">
          Second Pane Body
        </TabPane>
      </Tab>
    );
    
 }

Unontrolled

  import { Tab, TabPane } from 'senior-fe-challenge'
  
  function App() {
    return(
      <Tab initialActive={'First Pane'} > 
        <TabPane title="First Pane">
          First Pane Body
        </TabPane>
        <TabPane title="Second Pane">
          Second Pane Body
        </TabPane>
      </Tab>
    );
    
 }

Passing active and initialActive props at the same time will be a type error.

Props

TabPaneProps

NameMandatoryTypeDefault valueDescription
titletruestringPanel's title

TabProps

NameMandatoryTypeDefault valueDescription
childrentrueReact.ReactElement[]Panels
initialActivefalsestringWhen uncontrolled, title of first tab to render
activefalsestringWhen controlled, title of current tab selected
onActiveChangefalse(e: any) => voidfunction called when component controlled that return the title of selected Tab
0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago