Scaleway Form
Scaleway Form is an extension of Scaleway UI including everything to build forms using React. It is using React Final Form under the hood.
Installation
$ pnpm add @scaleway/form @emotion/react @emotion/styled
Usage
To use the library you need to put a ThemeProvider
from @emotion/react
with the theme that comes from @scaleway/ui
then wrap all your fields inside a Form
:
import { ThemeProvider } from '@emotion/react'
import { Form, TextInputField } from '@scaleway/form'
import { theme } from '@scaleway/ui'
export default function App() {
return (
<ThemeProvider theme={theme}>
<Form>
<TextInputField name="example" />
</Form>
</ThemeProvider>
)
}
Contribute
Add a validator
- Create a file under
src/validators/
folder - Export a default function with a type : (arg: unknown) => ValidatorObject
- Export it into
src/validators/index.ts
- Add the key into the
ValidatorProps
type insrc/types.ts
- Add tests into
src/validators/__tests__
folder
Documentation
Checkout our documentation website.