npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nozzlegear/react-win-pivot

v2.0.1

Published

An attempt to recreate the Pivot element from WinJS in React.

Downloads

3

Readme

@nozzlegear/react-win-pivot

Screeshot of react-win-pivot

Installation

With Yarn:

yarn install @nozzlegear/react-win-pivot

Or from NPM:

npm install @nozzlegear/react-win-pivot --save

Importing

Import the component via ES6 import:

import { Pivot } from "@nozzlegear/react-win-pivot";
// or use default import
import Pivot from "@nozzlegear/react-win-pivot";

Example

import * as React from "react";
import { Pivot } from "../index";

type Tab = "First Tab" | "Second Tab" | "Third Tab";

const DEFAULT_TABS: Tab[] = [
    "First Tab",
    "Second Tab",
    "Third Tab",
]

function MyPivotComponent(): JSX.Element {
    const [selectedTab, setSelectedTab] = React.useState(DEFAULT_TABS[0]);

    return (
        <Pivot animate={true} tabs={DEFAULT_TABS} selectedTab={selectedTab} onChange={setSelectedTab}>
            <div>
                <h1>{`This is the ${selectedTab}.`}</h1>
            </div>
        </Pivot>
    )
}

Props

Note: This package has full TypeScript definitions! You should automatically receive intellisense for all of the props documented below:

| Name | Type | Required | Description | |------|------|----------|-------------| | animate | boolean | Required | Indicates that the pivot should animate when it renders and each time the selected tab changes. | | animationDuration? | number | Optional, default 200 | The duration of the animation in milliseconds. Only used when animate is true. | | tabs | string[] | Required | An array of strings to be used as the name of the tabs, e.g. "Tab 1", "Tab 2". | | selectedTab | string | Required | The currently selected tab. Must be one of the string values from tabs. | | onChange | (newTab: string) => void | Required | A function that's called when the user attempts to change the selected tab. Note that this is only a notification that the user wants to change the tab, it will not change itself. | | children | React.ReactNode | Required | Content to show in the Pivot's content area. |

Styling

If you'd like to style the Pivot components yourself, you can change the following CSS variables with your own stylesheet:

| Name | Default value | | ---- | ------------- | | --pivot-tabs-font-family | inherit | | --pivot-tabs-font-size | 24px | | --pivot-tabs-font-color | rgba(0,0,0,.6) | | --pivot-tabs-active-font-color | #000 | | --pivot-tabs-padding | 20px 20px 20px 0 | | --pivot-tabs-column-gap | 20px | | --pivot-tabs-border-width | 0 0 1px 0 | | --pivot-tabs-border-style | solid | | --pivot-tabs-border-color | #ccc | | --pivot-tabs-content-padding | 0 | | --pivot-tabs-slide-in-start-opacity | 0 | | --pivot-tabs-slide-in-end-opacity | 1 | | --pivot-tabs-slide-in-transition | all 0.1s ease-in-out | | --pivot-tabs-slide-in-transform | translate(0, 0) | | --pivot-tabs-slide-in-from-left-transform | translate(-100px, 0px) | | --pivot-tabs-slide-in-from-right-transform | translate(100px, 0px) | | --pivot-tabs-slide-in-from-below-transform | translate(0px, 100px) |

Example:

.react-win-pivot {
    /* Change the padding of the tabs list */
    --pivot-tabs-padding: 40px 0;
    /* Change the css transition for animated tabs */
    --pivot-tabs-slide-in-transition: all 0.15s linear;
}