Field Set

Fieldsets encapsulate the composition of form controls, labels & validation messages with the necessary attributes to ensure good accessibility for screen readers.

Inputs

Storybook failed to load.

Selects

Storybook failed to load.

Autosuggests

Storybook failed to load.

Checkboxes

Storybook failed to load.

Textareas

Storybook failed to load.

Datepickers

Storybook failed to load.

bpk-component-fieldset

Backpack fieldset component.

Installation

Check the main Readme for a complete installation guide.

Usage


                                                
                                                import { Component } from 'react';
                                                import BpkFieldset from '@skyscanner/backpack-web/bpk-component-fieldset';
                                                import BpkInput, { INPUT_TYPES } from '@skyscanner/backpack-web/bpk-component-input';
                                                
                                                class FieldsetContainer extends Component {
                                                  constructor(props) {
                                                    super(props);
                                                
                                                    this.state = {
                                                      value: '',
                                                    };
                                                
                                                  }
                                                
                                                  onChange = (e) => {
                                                    this.setState({
                                                      value: e.target.value,
                                                    });
                                                  }
                                                
                                                  render() {
                                                    const isValid = this.state.value !== '';
                                                
                                                    return (
                                                      <BpkFieldset
                                                        label="Name"
                                                        validationMessage="Please enter a name"
                                                      >
                                                        <BpkInput
                                                          id="name_input"
                                                          name="name"
                                                          type={INPUT_TYPES.text}
                                                          placeholder="e.g. Joe Bloggs"
                                                          value={this.state.value}
                                                          valid={isValid}
                                                        />
                                                      </BpkFieldset>
                                                    );
                                                  }
                                                }

Props

Check out the full list of props on Skyscanner's design system documentation website.

Props

Storybook failed to load.