GithubHelp home page GithubHelp logo

rebassjs / rebass Goto Github PK

View Code? Open in Web Editor NEW
7.9K 60.0 658.0 15.31 MB

:atom_symbol: React primitive UI components built with styled-system.

Home Page: https://rebassjs.org

License: MIT License

JavaScript 100.00%
javascript react css ui styled-components rebass design-system react-components styled-system components

rebass's Introduction

Rebass

React primitive UI components built with Styled System. https://rebassjs.org

Build Status Coverage Downloads Version MIT License

npm i rebass

Getting Started

import React from 'react'
import { Box, Heading, Button } from 'rebass'

export default props =>
  <Box>
    <Heading>Hello</Heading>
    <Button>Rebass</Button>
  </Box>

Features

  • Start your design system without boiling the ocean
  • Build consistent UI with design constraints and user-defined scales
  • Best-in-class developer ergonomics with Styled System props
  • First-class support for theming & fully compatible with Theme UI
  • Quick, mobile-first responsive styles with array-based syntax
  • Flexbox layout with the Box and Flex components
  • Flexibility built in for high design & development velocity
  • Minimal footprint at about 4KB

"One of the best React component libs out there"

Max Stoiber

"Rebass is the Bootstrap of React."

Jori Lallo

"A whopper component library built on styled-components. Responsive, systematic, scalable...the business!"

Colm Tuite

Principles

Rebass is intended to be:

  • Minimal
  • Useful
  • Unopinionated
  • Flexible
  • Consistent
  • Extensible
  • Themeable

Do one thing, and do it well

Unix philosophy

See Patterns for Style Composition in React for more on some of the thought behind Rebass.

Documentation

CodeSandbox

Try it out: https://codesandbox.io/s/github/rebassjs/rebass/tree/master/examples/sandbox

Related

Upgrading from v3

See the Migration Guide.

Previous Versions


Contributing | MIT License

rebass's People

Contributors

1800joe avatar bosek avatar corygibbons avatar dependabot-preview[bot] avatar emmatown avatar firedev avatar greenkeeperio-bot avatar gregwym avatar gribnoysup avatar gyfis avatar johno avatar jxnblk avatar kerumen avatar kikobeats avatar lachlanjc avatar lowmess avatar macklinu avatar maiertech avatar maxbeatty avatar namuol avatar nfcampos avatar ptgolden avatar pungggi avatar redmundas avatar rileytomasek avatar ryuken avatar tpict avatar trysound avatar windkomo avatar youfoundron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rebass's Issues

Advanced Components

  • Navbar Collapse
  • Collapse Trigger
  • Tabs (disclosure mechanism)
  • Modal Trigger
  • Tooltip
  • Popover

max height/width example for Media component?

First instinct was thinking that there should be props for it, but you probably know of a better way. Do you have an example of doing this?

Problem is super large images, or images of different sizes create crazy looking lists.

Is using reflexbox the solution here?

lists?

open to a PR for lists + different list items?

Warning: "Invalid prop `Component` supplied to `NavItem`" when using react-router Link

It looks like the Link component class supplied by React-Router (v2.0.0) doesn't pass the NavItem.propTypes.Component test (it's not a React.PropTypes.node, it's a class).

My code:

import { Link } from 'react-router';
// ...
<NavItem Component={Link} to='/'>Home</NavItem>

console warning:

Warning: Failed propType: Invalid prop `Component` supplied to `NavItem`, expected a ReactNode. Check the render method of `Root`.

It looks like the Link is rendered correctly, however, so I think it's just a matter of changing the propTypes rule to accept a component class?

Error: Cannot find module "colors.css"

I include a module:

import {Button} from 'rebass'

When I try to build this with webpack, I get this error:

Error: Cannot find module "colors.css"

node_modules/rebass/dist/Button.js requires colors.js, which in turn requires colors.css. However, this file is not packaged in the dist directory, thus causing the error.

Any suggestions on how to solve this?

Cannot find module '.'

This happens on Node 0.12.7 + Babel 6
Seems to be resolved after switching to Node 5.7

I think it has to do with the way things are exported in index.js

var _ = require('.');

Using font from npm module

Hi,

i was wondering if there is any way to use a font from a npm module?

Greetz,
boristian

@jxnblk: Thank you for sharing your work., it's awesome.

Components are not pure

First, Thanks for the awesome work.

Even tho the components you've written are all stateless components, they are still not treated as pure by React; which means that React will re-render them all even tho their props did not change.

See facebook/react#5677

I understand that Layout components like Container, Box should not behave this way otherwise child components would not be rendered at all. but leaf components such as Button etc would benefit from it ?

On way we could get around this here would be to implement the shouldComponentUpdate method and do a shallowCompare of the props.

Use Babel (and ES6)

Using Babel and ES6 is awesome. Rebass should use it! Happy to provide a PR if it's a direction you'd like to take it.

Layout Components

  • Html
    • Allow for stylesheet and scripts arrays
    • Allow for custom head content
  • Collapsing fixed sidebar to off-canvas
  • Holy Grail

InputRange Should Have a Callback Function

Firstly, love what you've done here and really appreciate your efforts. I can see this being very useful. I'd love to see a react-native version.

For things like InputRange, shouldn't there be a callback function, something like onValueChange={ val => console.log(val) } to report the value back up to the parent component?

events on input like `onChange`, `onBlur` get called twice

Hey @jxnblk, awesome library!

When using the <Input /> component, event handlers always get called twice. This is because you capture all events into rootProps and after that you apply them to two <Base />components

  const {
    rounded,
    backgroundColor,
    theme,
    inverted,
    // event handlers go into this variable
    ...rootProps
  } = props

// later
<Base
  // applies onClick, onBlur etc.
  {...rootProps}
>
  // applies onClick, onBlur etc. again
  <Base
    {...props}
    type='input'
  >
  </Base>
</Base>

My best advice is to switch to something like a rootProps prop on Input and then delegate the rest of the props to the Input component. I can create a pull request if you agree with that.

const Input = ({
  label,
  name,
  type,
  message,
  hideLabel,
  children,
  rootProps,
  ...props
}, { rebass }) => {
  const {
    rounded,
    backgroundColor,
    theme,
    inverted
  } = props

  return (
    <Base
      {...rootProps}
      >

      <Base
        {...props}
      />
        {message && <Text small children={message} />}
    </Base>
  )
}

Another option would be to filter out all events and delegate them to the second <Base />. This would require a list of events though.

EDIT: Same problem exists for <Select />

Build still failing

When executing , you still have some import failing, i think due to wrong package.json in other repos
screenshot 2015-08-30 21 05 15
screenshot 2015-08-30 21 06 38

README example wrong/confusing

The example in the README declares class App and uses root element of . This is confusing! Maybe it should use <Container> instead?

class App extends React.Component {
  render () {
    return (
      <App> ...

React Router

How does one create a NavItem with a react-router Link? Excuse my n00b-ness, I'm quite new to react.

npm snafu

I installed and poked a bit before seeing that 1.5 (from npm install rebass and github) doesn't match the docs (0.2.0-beta7). Then I had to npm install colors.css

Basic Components

  • NavItem
  • Badge
  • Message
  • Dropdown - use summary/details elements
  • Group
  • Modal - Use dialog element
  • Navbar
  • NavSpacer
  • NavItem
  • Icon
  • Menu
  • Pagination
  • Breadcrumbs
  • Progress

CHANGES.md

Is there a place to look to see changes?

Issues during build

First issue is that in package.json you reference

"basscss.github.io": "github:basscss/basscss.github.io"

but since its ssh version only you get access. So npm install will only work if changed to:

"basscss.github.io": "https://github.com/basscss/basscss.git"

then npm start fails on some docs.css, here is the paste bin http://pastebin.com/DQhkDdDp

Dumb and Smart Components

  • All UI (visually styled) components should be dumb/stateless
  • Smart components should be used to handle progressive disclosure, removing elements, etc.

Docs MVP

  • Highlight js example component
  • Components array with examples and documentation content
  • Kitchen sink page
  • Undocumented components test page
  • Home page copy
  • Update Basscss button .is-active states
  • Home page banner
  • Components in-page nav
  • Sidebar overlay
  • Touch scroll
  • Disable touch highlight

Introduce shorthand properties

I really like the minimalist approach of this lib after ditching material-ui.

I have a proposal to make the components even more easier to read:

Given the current state

<Flex
  align="center"
  justify="space-between"
  wrap={true}
>

What do you think about:

<Flex center space-between wrap>

Would that make sense?

Documentation examples are all minified

All code examples show minified tags, e.g. http://jxnblk.com/rebass/#Col:

<t>
  <t
    sm={6}
    md={4}
    lg={3}>
    Col sm6 md4 lg3
  </t>
  <t
    sm={6}
    md={4}
    lg={3}>
    Col sm6 md4 lg3
  </t>
  <t
    sm={6}
    md={4}
    lg={3}>
    Col sm6 md4 lg3
  </t>
  <t
    sm={6}
    md={4}
    lg={3}>
    Col sm6 md4 lg3
  </t>
  <t
    sm={6}
    md={4}
    lg={3}>
    Col sm6 md4 lg3
  </t>
  <t
    sm={6}
    md={4}
    lg={3}>
    Col sm6 md4 lg3
  </t>
</t>

Client side use

Seems clear how to use rebass in the node environment, but I'd like it made clearer how to use it on the client side.

Default styles for complex components

What is the best approach for setting a default style on complex components? In other words, how do I add a global style for the help text underneath an <Input /> control?

Are you opened to pull request?

if yes, there is a bit of work to make it work since you make internal ref to github repos we dont have access to. Also half of npm deps are out-of date. Basically its unbuildable in the current state.
Do you think you can make it ready for PRs ?
I'd love to propose you some new components :p

Classname prop

Would it not be nice to be able to pass down classNames on components so you don't have to wrap the components with another block just to put a className on it?

For example:

<Toolbar className="Nav" color="white"></Toolbar>

instead of:

<nav className="Nav">
  <Toolbar color="white"></Toolbar>
</nav>

I would be willing to submit a PR to address this if this is a legitimate issue and not just how you explicitly designed the components.

Thanks!

Andy

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.