🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@ndla/tabs

Package Overview
Dependencies
Maintainers
0
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ndla/tabs

React Tabs component for NDLA

4.0.9
latest
Source
npm
Version published
Weekly downloads
275
-61.86%
Maintainers
0
Weekly downloads
 
Created
Source

ndla-tabs

A simple tabs component.

Installation

yarn add --save @ndla/tabs
npm install @ndla/tabs --save

Usage

Basic example

import { Tabs } from "@ndla/tabs";
import BananaComponent from "banana";
import PickleComponent from "picke";

const Fruits = () => {
  const fruitTabs = [
    {
      title: "Apple",
      id: "apple",
      content: <p>An apple a day keeps the doctor away</p>,
    },
    {
      title: "Orange",
      id: "orange",
      content: () => <h1>Orange is the new black</h1>,
    },
    { title: "Banana", id: "banana", content: <BananaComponent /> },
    {
      title: "Pickle",
      id: "pickle",
      content: <PickleComponent />,
      disabled: true,
    }, // No vegetables allowed!
  ];
  return <Tabs tabs={fruitTabs} />;
};

Example where selected tab is controlled via selectedIndex prop

import Tabs from "@ndla/tabs";
import fruitTabs from "fruit-tabs";

const FruitTabSelector = () => {
  const [value, setValue] = useState(undefined);
  return (
    <div>
      <button onClick={() => setValue("banana")}>Show banana tab</button>
      <Tabs value={value} tabs={fruitTabs} />
    </div>
  );
};

Keywords

ndla

FAQs

Package last updated on 19 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts