Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
grommet-forms
Advanced tools
Collection of higher order components for constructing forms with Grommet UX
NOTICE: This library is being actively developed. Use with caution until a proper release has been published.
Collection of higher order components for constructing forms with Grommet UX
Forms can often be the most time consuming part of your project. Tons of state? :check: complex hierarchies of data? Yep, you get the point. What we found when we were building our forms was that the best method was to render the form from a data structure stored in your state tree and to alter that state through redux.
Here's an example from a recent project of ours.
// In some reducer in your app
sectionLayoutForm: {
title: "Section Layout",
id: 'section-layout-form',
fields: [
{
label: "Flex Direction",
error: null,
help: "How should the content flow? Row: left to right, Column: top to bottom.",
name: "direction",
type: "Select",
value: 'row',
fieldProps: {
options: ["row", "column"],
}
},
{
label: "Justify Content",
error: null,
help: "Justify content to the left / right.",
name: "justify",
type: "Select",
value: 'start',
fieldProps: {
options: ["start", "center", "between", "end"],
}
},
{
label: "Align Items",
error: null,
help: "Align items to the top / bottom.",
name: "align",
type: "Select",
value: 'start',
fieldProps: {
options: ["start", "center", "end", "baseline", "stretch"],
}
},
{
label: "Padding",
error: null,
name: "pad",
help: "How much space should the container add around content?",
type: "Select",
value: 'small',
fieldProps: {
options: ["small", "medium", "large", "none"],
}
},
{
label: "Full",
error: null,
help: "Should the section span the full width / height of the container.",
name: "full",
type: "Select",
value: 'false',
fieldProps: {
options: ["horizontal", "vertical", "true", "false"],
}
},
{
label: 'Wrap',
error: null,
help: "Should the content ever wrap onto a new line?",
name: 'wrap',
type: 'Select',
value: 'false',
fieldProps: {
options: ["true", "false"],
}
},
{
label: "Flex Basis",
error: null,
help: "The basis of inner items. Prefer setting item size vs. flex-basis.",
name: "basis",
type: "Select",
value: 'full',
fieldProps: {
options: [
"xsmall", "small",
"medium", "large",
"xlarge", "xxlarge",
"full", "1/2",
"1/3", "2/3",
"1/4", "3/4"
],
onSearch: ({ target }, props) => props.options.filter(i => i.includes(target.value))
}
}
]
},
// In your connected component
import GrommetForm from 'grommet-forms';
<GrommetForm form={this.props.sectionLayoutForm} />
We love JSX, but sometimes you just end up writing too much of it. The hope with this library is that you will save yourself some keystrokeys. Pass the form renderer a blob of data describing the hierarchy of your form / fields and get back a rendered form whose state is managed automatically by Redux (or not, that part is up to you!).
All of the Grommet form components are supported. When you create your field object, set the type
property to one of the Grommet Form Field types.
Each object in your fields array must contain a type
and a value
property, along with FormField properties such as help
and label
. The fieldProps
object can contain any of the props that the field type supports, including functions. Refer to the Grommet Docs website for a list of supported props. You can also reference the source code to see the PropTypes (Flow Types) that we use internally.
FAQs
Collection of higher order components for constructing forms with Grommet UX
The npm package grommet-forms receives a total of 1 weekly downloads. As such, grommet-forms popularity was classified as not popular.
We found that grommet-forms demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.