@saunos/restyle-components
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@saunos/restyle-components

@saunos/restyle-components is a library that provides jsx transform to expose css prop from Restyle for React components.

Features

  • 🎨 Use ReStyle's css prop with React's function components

Installation

npm install @saunos/restyle-components restyle

Setup

  1. Update your tsconfig.json to use the custom JSX transform:
{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "@saunos/restyle-components"
  }
}
  1. If you prefer per-file configuration, add this comment at the top of your .tsx files:
/** @jsxImportSource @saunos/restyle-components */

Usage

Here's a basic example of how to use @saunos/restyle-components:

import React from 'react';
import { Button, Text } from '@mantine/core';
import { theme } from './theme';

function App() {
  return (
    <div>
      <Button
        css={{
          backgroundColor: theme.colors.primary,
          marginBottom: theme.spacing.m,
        }}
      >
        Styled Button
      </Button>
      <Text
        css={{
          fontSize: 18,
        }}
      >
        Styled Text
      </Text>
    </div>
  );
}

API Reference

css prop

Please refer to Restyle's docs for more details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i @saunos/restyle-components

Weekly Downloads

5

Version

0.2.0

License

ISC

Unpacked Size

10.2 kB

Total Files

21

Last publish

Collaborators

  • mkatrenik