🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more
Socket
Book a DemoInstallSign in
Socket

bpk-component-fieldset

Package Overview
Dependencies
Maintainers
7
Versions
522
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bpk-component-fieldset

Backpack fieldset component.

latest
Source
npmnpm
Version
5.1.2
Version published
Weekly downloads
477
1092.5%
Maintainers
7
Weekly downloads
 
Created
Source

bpk-component-fieldset

Backpack fieldset component.

Installation

npm install bpk-component-fieldset --save-dev

Usage

import React, { Component } from 'react';
import BpkFieldset from 'bpk-component-fieldset';
import BpkInput, { INPUT_TYPES } from '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

PropertyPropTypeRequiredDefault Value
childrennodetrue-
labelstringtrue-
classNamestringfalsenull
disabledboolfalsefalse
isCheckboxboolfalsefalse
requiredboolfalsefalse
validboolfalsenull
validationMessagestringfalsenull
validationPropsobjectfalse{}
descriptionstringfalsenull

Note: There are a couple of props that behave differently when using isCheckbox:

  • valid: checkboxes don't have a valid prop so you have to apply it to the fieldset directly
  • label: checkboxes have their own labels so it's safe to omit these

FAQs

Package last updated on 30 Sep 2022

Did you know?

Socket

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.

Install

Related posts