Sha256: 11724d5085bea10b6e5920400c9a3e22dda046707b057d044f207d9099ed4a99

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

/* @flow */
/*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */

import React from 'react'
import Body from '../pb_body/_body.jsx'

type RadioProps = {
  className?: String,
  data?: String,
  id?: String,
  label: String,
  name: String,
  value: String,
  checked?: Boolean,
  dark?: Boolean,
  text: String,
  children?: Node,
  onChange: (Boolean)=>void,
}

const Radio = (props: RadioProps) => {
  const {
    checked = false,
    children,
    className,
    dark = false,
    data,
    id,
    label,
    name,
    value,
    text,
    onChange = () => {},
  } = props

  return (
    <label
        className={'pb_radio_kit' + (dark === true ? '_dark ' : ' ') + className}
        htmlFor={id}
    >
      <If condition={children}>
        {children}
        <Else />
        <input
            checked={checked}
            data={data}
            name={name}
            onChange={onChange}
            text={text}
            type="radio"
            value={value}
        />
      </If>
      <span className="pb_radio_button" />
      <Body
          dark={dark}
          text={label}
      />
    </label>
  )
}

export default Radio

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
playbook_ui-3.4.0 app/pb_kits/playbook/pb_radio/_radio.jsx