@47deg/codetab
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

Built With Stencil

Codetab

Tab selector web component.

Installation

Load it from a CDN

  • Put a script tag similar to this <script src='https://unpkg.com/@47deg/codetab/dist/codetab/codetab.js'></script> in the head of your index.html.
  • Then you can use the element anywhere in your template, JSX, html etc.

Host your own instance

  • Run npm install @47deg/codetab --save.
  • Put a script tag similar to this <script src='node_modules/@47deg/codetab/dist/codetab.js'></script> in the head of your index.html.
  • Then you can use the element anywhere in your template, JSX, html etc.

In JS environment app

  • Run npm install @47deg/codetab --save.
  • Add an import to the npm packages import @47deg/codetab;.
  • Then you can use the element anywhere in your template, JSX, html etc.

Usage

Once loaded on your site, you can simply use it like this:

<fortyseven-codetab data-languages='["Scala", "Kotlin", "Swift", "Haskell]'>
  <code>
    Scala code snippet
  </code>
  <code>
    Kotlin code snippet
  </code>
  <code>
    Swift code snippet
  </code>
  <code>
    Haskell code snippet
  </code>
</fortyseven-codetab>

Codetab will show one element at a time depending on the tab you have selected. The web component will respect styles associated with those elements, so will happen with any code highlighting, which are responsibility of your website styling.

Contributing or modifying this web component

Codetab is built with Stencil, a compiler for building fast web apps using Web Components.

Stencil components are just Web Components, so they work in any major framework or with no framework at all. To start playing with it, clone this repo to a new directory:

git clone https://github.com/47degrees/codetab.git codetab
cd codetab

and run:

npm install
npm start

To build the component for production, run:

npm run build

To run the unit tests for the components, run:

npm test

Need help? Check out our docs here.

Package Sidebar

Install

npm i @47deg/codetab

Weekly Downloads

8

Version

0.0.8

License

Apache-2.0

Unpacked Size

764 kB

Total Files

76

Last publish

Collaborators

  • rachelcarmena
  • calvellido