npm install @shopify/restyle

A system for building constraint-based UI components

About @shopify/restyle

The npm package @shopify/restyle is a powerful tool designed to empower developers in creating responsive and consistent UI components across their React Native applications. It utilizes a constraint-based system that focuses on scalability and maintainability, making it an essential asset for both small projects and large-scale enterprise applications. @shopify/restyle simplifies the process of theme management and component styling by using a unified style system. This approach helps in maintaining a cohesive design language and ensures that UI components adapt seamlessly across different devices and screen sizes, enhancing the user experience.

To get started with this innovative styling solution, developers can easily integrate the package into their projects using the npm install @shopify/restyle command. This command simplifies the installation process, allowing developers to quickly set up and start utilizing the system's full capabilities without hassle. Once installed, @shopify/restyle provides a robust set of tools and predefined rules that help in building efficient, attractive, and responsive UI components. By streamlining the development workflow, it reduces the time and effort typically required for styling components, thereby accelerating the development cycle.

One of the standout features of @shopify/restyle is its emphasis on theming. The package allows developers to define themes with a set of properties such as colors, spacing, and typography, which can be easily applied across all components. This not only promotes a consistent look and feel throughout the app but also makes it easier to implement and manage design changes. By abstracting common styling patterns into themes, @shopify/restyle aids in creating more readable and maintainable code, ultimately leading to a more efficient development process and a higher quality final product.

More from Shopify

Shopify npm packages

Find the best node modules for your project.

Search npm

@shopify/flash-list

FlashList is a more performant FlatList...

Read more
,

@shopify/polaris-icons

[![npm version](https://img.shields.io/npm/v/@shopify/polaris-icons.svg?style=flat)](https://www...

Read more
,

@shopify/polaris

Shopify’s admin product component...

Read more
,

@shopify/cli-kit

A set of utilities, interfaces, and models that are common across all the platform...

Read more
,

@shopify/cli

A CLI tool to build for the Shopify...

Read more
,

@shopify/draggable

The JavaScript Drag & Drop library your grandparents warned you about...

Read more
,

@shopify/app-bridge-core

**[Join our team and work on libraries like this one.](https://www.shopify...

Read more
,

@shopify/theme-check-common


Read more

,

@shopify/graphql-client

Shopify GraphQL Client - A lightweight generic GraphQL JS client to interact with Shopify GraphQL...

Read more
,

@shopify/storefront-api-client

Shopify Storefront API Client - A lightweight JS client to interact with Shopify's Storefront...

Read more
,

@shopify/restyle

A system for building constraint-based UI...

Read more
,

@shopify/theme-check-node

This is the Node.js wrapper of the runtime-agnostic [`@shopify/theme-check-common`](https://npm...

Read more

Dependencies

Core dependencies of this npm package and its dev dependencies.

@shopify/eslint-plugin, @tsconfig/react-native, @types/jest, @types/react, @types/react-test-renderer, babel-jest, eslint, gh-pages, jest, prettier, react, react-native, react-test-renderer, typescript

Documentation

A README file for the @shopify/restyle code repository. View Code

Restyle Image

Getting startedInstallationPlaygroundDiscord

Build a consistent, themed UI in minutes.

RestyleTheme 2020-02-25 17_43_51

The Restyle library provides a type-enforced system for building UI components in React Native with TypeScript. It's a library for building UI libraries, with themability as the core focus.

This library assumes that the UI is built upon a design system that (at the very least) defines a set of colors and spacing constants that lays as a foundation. While the library acknowledges that there can be exceptions to the system by allowing any style to be overridden, it keeps the developer most productive when one-off values are kept to a minimum.

Installation

Add the package to your project using one of the following:

yarn add @shopify/restyle
npm install @shopify/restyle
npx expo install @shopify/restyle

Usage

See Usage in the documentation, or see below for the fixture app.

App / Playground

The fixture is an example app to showcase the library's usage.

Running the Documentation site locally

To run the Documentation site locally, please follow the steps below:

  1. cd documentation
  2. yarn
  3. yarn start
  4. Go to http://localhost:3000/restyle/

Migrating to restyle v2

Read more about migration to v2 here

Inspiration

Restyle is heavily inspired by https://styled-system.com.

Contributing

For help on setting up the repo locally, building, testing, and contributing please see CONTRIBUTING.md.

Code of Conduct

All developers who wish to contribute through code or issues, take a look at the CODE_OF_CONDUCT.md.

License

MIT, see LICENSE.md for details.