0.1.14 • Published 2 years ago

senior-fe-challenge v0.1.14

Weekly downloads
-
License
ISC
Repository
github
Last release
2 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

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago