
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@patternfly-labs/react-form-wizard
Advanced tools
An opinionated framework for wizards using PatternFly.
npm install @patternfly-labs/react-form-wizard @patternfly/react-core @patternfly/react-styles
yarn add @patternfly-labs/react-form-wizard @patternfly/react-core @patternfly/react-styles
Import css from patternfly before importing react-form-wizard.
import '@patternfly/react-core/dist/styles/base.css'
import '@patternfly/react-styles/css/components/Wizard/wizard.css'
A wizard contains steps which contain sections which contain inputs.
import { WizardPage, Step, Section, TextInput, Select } from '@patternfly-labs/react-form-wizard'
function Example() {
return (
<WizardPage title="My Wizard">
<Step label="Details" id="details-step">
<Section label="Details">
<TextInput label="Name" path="name" required />
<Select label="Namespace" path="namespace" options={['default', 'namespace-1']} />
</Section>
</Step>
</WizardPage>
)
}
The wizard works by setting an item context which inputs use as a data source. Inputs then get value or set value in the item context using path notation.
function Example() {
return (
<TextInput label="Name" path="metadata.name" required />
)
}
Some inputs can change the item context, such as the ArrayInput
.
function Example() {
return (
<ArrayInput path="resources" placeholder="Add new resource">
<TextInput label="Name" path="metadata.name" required />
<Select label="Namespace" path="metadata.namespace" options={['default']} required/>
</ArrayInput>
)
}
The root data can either be an object or an array of objects.
When working with an array of objects anItemSelector
can be used to set the item context specific item.
function Example() {
return (
<ItemSelector selectKey="kind" selectValue="Application">
<TextInput label="Name" path="metadata.name" required />
<Select label="Namespace" path="metadata.namespace" options={['default']} required/>
</ItemSelector>
)
}
ArrayInput
can also be used to work with a subset of items in this case.
function Example() {
return (
<ArrayInput path={null} filter={(item) => item.kind === 'Subscription'}>
<TextInput label="Name" path="metadata.name" required />
<Select label="Namespace" path="metadata.namespace" options={['default']} required/>
</ArrayInput>
)
}
Inputs take an optional validation function. The validation function takes in the current item context and input value. It should returns a validation error string if the validation fails.
Inputs take an optional hidden function. The hidden function takes in the current item context, and returns true if the input should be hidden.
Steps
and Sections
automatically hide if all its inputs are hidden. This makes it easy to make a wizard with conditional flow.
See the wizards directory for example wizards.
If you plan on contributing, please fork the repo and create a pull request using your fork.
Clone the repo
git clone git@github.com:patternfly-labs/react-form-wizard.git
Install dependencies
npm ci
Start the project
npm start
FAQs
A Patternfly react wizard framework.
We found that @patternfly-labs/react-form-wizard demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers 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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.