Have ideas to improve npm?Join in the discussion! »

    @hawk-ui/radio

    2.13.1 • Public • Published

    Installation

    To install a component run

    $ npm install @hawk-ui/radio --save

    Please import CSS styles via

    @import '/path__to__node_modules/@hawk-ui/radio/dist/index.min.css

    Usage

    Without Required

    Demo

    import Radio from '@hawk-ui/radio';
    initialState = {
      fruits: [
        { key: 1, label: 'apple', value: 'apple' },
        { key: 1, label: 'mango', value: 'mango' },
        { key: 1, label: 'banana', value: 'banana' },
        { key: 1, label: 'orange', value: 'orange' },
        { key: 1, label: 'pineapple', value: 'pineapple' },
      ],
      selectedItem: '',
    };
    
    <Radio
      options={state.fruits}
      selectedItem={state.selectedItem}
      onChange={(event) => {
        setState({
          selectedItem: event.target.value
        });
      }}
    />

    With Required

    Demo

    import Radio from '@hawk-ui/radio';
    initialState = {
      fruits: [
        { key: 1, label: 'apple', value: 'apple' },
        { key: 1, label: 'mango', value: 'mango' },
        { key: 1, label: 'banana', value: 'banana' },
        { key: 1, label: 'orange', value: 'orange' },
        { key: 1, label: 'pineapple', value: 'pineapple' },
      ],
      selectedItem: '',
    };
    
    <Radio
      label="Select Fruit"
      options={state.fruits}
      selectedItem={state.selectedItem}
      onChange={(event) => {
        setState({
          selectedItem: event.target.value
        });
      }}
      isRequired
      isError
      errorMessage="This field is a compulsory field."
    />

    Install

    npm i @hawk-ui/radio

    DownloadsWeekly Downloads

    6

    Version

    2.13.1

    License

    MIT

    Unpacked Size

    29.9 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar