Giter VIP home page Giter VIP logo

kit's Introduction

Compositor Kit

Tools for developing, documenting, and testing React component libraries

  • Zero-config development server
  • Component library mode
  • Utility components for demos and development
  • Reuse component examples for development, documentation, and testing
  • Read more about Kit on our blog

Getting Started

Install the Kit CLI to get started with isolated component development.

npm i -g @compositor/kit-cli

Create an examples folder for your components. This folder can be used for development, documentation, and testing purposes.

An example file should export a single default component for rendering.

// Button.js example
import React from 'react'
import { Button } from '../src'

export default props =>
  <Button>Button</Button>

Start the development server.

kit examples

The index will show a list of links to each example. Each example will have its own route where it can be viewed in isolation.

Library Mode

To view all examples in library mode with persistent navigation, use the --mode flag.

kit examples --mode library

Utility Components

If you already have an existing development setup, or want to enhance your examples, use the Kit components directly in any React setup.

npm i @compositor/kit

Library

Use the Library, Example, and Detail components to create a custom component library view.

import React from 'react'
import { Library, Example } from '@compositor/kit'
import { Button } from '../src'

export default props =>
  <Library>
    <Example name='Button'>
      <Button>Button</Button>
    </Example>
  </Library>

XRay

Use the XRay component to outline HTML elements and display a grid to help ensure your UI is visually aligned.

import React from 'react'
import { XRay } from '@compositor/kit'
import { Button } from '../src'

export default props =>
  <XRay>
    <Button>Button</Button>
  </XRay>

Cartesian

Use the Cartesian component to render the cartesian product of props.

import React from 'react'
import { Cartesian } from '@compositor/kit'
import Button from '../src/Button'

export default props => (
  <Cartesian
    component={Button}
    m={4}
    fontSize={[1, 2, 3]}
    bg={['blue', 'pink', 'tomato', 'purple']}
    children={['Hello, world!', 'Beep']}
  />
)

Responsive

Use the Responsive component to render components in multiple iframes at different viewport sizes.

import React from 'react'
import { Responsive } from '@compositor/kit'
import PageHeader from '../src/PageHeader'

const example = (
  <Responsive>
    <PageHeader />
  </Responsive>
)

Other Components

See the Kit components package for more components.

Kit Init

Use the kit init command to create a new project based on a growing set of templates.

Utlities

  • kit-snapshot: run Jest snapshot tests for example components

Related

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Made by Compositor | MIT License

kit's People

Contributors

johno avatar jxnblk avatar corygibbons avatar lachlanjc avatar

Watchers

James Cloos avatar Trending Technology avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.