Sha256: 844bbc3a766ae52debed7f9a895187e750c0f3ccb967386d23277c365dd0d6d5

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { Caption } from '../'
import { type InputCallback } from '../types.js'

type TextareaProps = {
  className?: String,
  children?: Array<React.ReactChild>,
  data?: String,
  id?: String,
  object?: String,
  method?: String,
  label?: String,
  placeholder?: String,
  value?: String,
  name?: String,
  rows?: Number,
  dark?: Boolean,
  onChange?: InputCallback,
}

const Textarea = ({
  className,
  children,
  label,
  onChange = () => {},
  placeholder,
  value,
  dark = false,
  rows = 4,
  name,
}: TextareaProps) => {
  const textareaClass = `pb_textarea_kit${dark ? '_dark' : ''}`

  return (
    <div className={classnames(textareaClass, className)}>
      <Caption
          dark={dark}
          text={label}
      />
      <If condition={children}>
        {children}
        <Else />
        <textarea
            className={textareaClass}
            name={name}
            onChange={onChange}
            placeholder={placeholder}
            rows={rows}
            value={value}
        />
      </If>
    </div>
  )
}

export default Textarea

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
playbook_ui-3.4.0 app/pb_kits/playbook/pb_textarea/_textarea.jsx
playbook_ui-3.3.0 app/pb_kits/playbook/pb_textarea/_textarea.jsx
playbook_ui-3.2.0 app/pb_kits/playbook/pb_textarea/_textarea.jsx