综合技术

Simple and customizable react file input with a11y in mind

微信扫一扫,分享到朋友圈

Simple and customizable react file input with a11y in mind
0

React File Button

Simple and customizable react file input with a11y in mind.

Install

yarn add react-file-button
/ npm install react-file-button --save

Use

import FileButton from 'react-file-button';

const customButtonStyle = {
  background: '#0fc',
  fontSize: 18,
  border: 0,
  padding: '20px 40px',
  borderRadius: 4,
  color: '#000',
  display: 'inline-block',
};

 (
    
{files.length ? `Files chosen: ${files.length}` : 'Chose files'}
)} />;

Props

All input props available plus renderButton: (value: string, files: FileList | []) => ReactNode
that renders a custom button. Takes two arguments: value
and files
and should return react node. className
and style
properties will apply on component root (label).

Latest version uses hooks and requires react@16.7.0-alpha.x
to work. You can use 1.x
version if don’t want that.

阅读原文...


微信扫一扫,分享到朋友圈

Simple and customizable react file input with a11y in mind
0

Github

联想 CES 汇总:做了款「Surface Studio」,还有可变身智能音箱的平板

上一篇

发力5G!中国联通获准发行不超过500亿元公司债

下一篇

评论已经被关闭。

插入图片

热门分类

往期推荐

Simple and customizable react file input with a11y in mind

长按储存图像,分享给朋友