Back to React Jsonschema Form

README

packages/chakra-ui/README.md

6.5.25.1 KB
Original Source

<!-- PROJECT LOGO --> <p align="center"> <a href="https://github.com/rjsf-team/react-jsonschema-form"> </a> <h3 align="center">@rjsf/chakra-ui</h3> <p align="center"> Chakra UI theme, fields and widgets for <a href="https://github.com/rjsf-team/react-jsonschema-form/"><code>react-jsonschema-form</code></a>.
<a href="https://rjsf-team.github.io/react-jsonschema-form/docs/"><strong>Explore the docs »</strong></a>




<a href="https://rjsf-team.github.io/react-jsonschema-form/">View Playground</a>
·
<a href="https://github.com/rjsf-team/react-jsonschema-form/issues">Report Bug</a>
·
<a href="https://github.com/rjsf-team/react-jsonschema-form/issues">Request Feature</a>
</p> </p> <!-- TABLE OF CONTENTS -->

Table of Contents

<!-- ABOUT THE PROJECT -->

About The Project

Exports chakra-ui theme, fields and widgets for react-jsonschema-form.

Built With

<!-- GETTING STARTED -->

Getting Started

Prerequisites

  • @chakra-ui/react >= 3
  • chakra-react-select >= 6
  • @rjsf/core >= 6
  • @rjsf/utils >= 6
  • @rjsf/validator-ajv8 >= 6

Refer to the rjsf installation guide and chakra-ui installation guide and for more details.


Installation

bash
yarn add @chakra-ui/react chakra-react-select @rjsf/core @rjsf/utils @rjsf/validator-ajv8

Usage

bash
yarn add @rjsf/chakra-ui
<!-- USAGE EXAMPLES -->
js
import Form from '@rjsf/chakra-ui';

or

js
import { withTheme } from '@rjsf/core';
import { Theme as ChakraUITheme } from '@rjsf/chakra-ui';

// Make modifications to the theme with your own fields and widgets

const Form = withTheme(ChakraUITheme);

Optional Chakra UI Theme properties

  • To pass additional properties to widgets, see this guide.

You can use ChakraProvider, to customize the components at a theme level.
And, uiSchema allows for the use of a "chakra" "ui:option" to customize the styling of the form widgets.

Custom Chakra uiSchema Chakra Property

json
{
  "ui:options": {
    "chakra": {
      "p": "1rem",
      "color": "blue.200",
      "sx": {
        "margin": "0 auto"
      }
    }
  }
}

It accepts the theme accessible style props provided by Chakra and Emotion.

<!-- ROADMAP -->

Roadmap

See the open issues for a list of proposed features (and known issues).

<!-- CONTRIBUTING -->

Contributing

Read our contributors' guide to get started.

<!-- CONTACT -->

Contact

rjsf team: https://github.com/orgs/rjsf-team/people

GitHub repository: https://github.com/rjsf-team/react-jsonschema-form

<!-- MARKDOWN LINKS & IMAGES --> <!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->