npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@uiw/react-descriptions

v4.22.3

Published

Descriptions component

Downloads

963

Readme

Descriptions 描述列表

Buy me a coffee Open in unpkg NPM Downloads npm version

成组展示多个只读字段。

import { Descriptions } from 'uiw';
// or
import Descriptions from '@uiw/react-descriptions';

基础用法

简单的展示。

import React from 'react';
import { Descriptions } from 'uiw';

export default function Demo() {
  return(
    <Descriptions title="用户信息">
      <Descriptions.Item label="姓名">调调</Descriptions.Item>
      <Descriptions.Item label="手机号码">1360000000</Descriptions.Item>
      <Descriptions.Item label="居住地">上海市,青浦区</Descriptions.Item>
      <Descriptions.Item label="备注">-</Descriptions.Item>
      <Descriptions.Item label="地址">
        中国湖北省黄冈市罗田县666号
      </Descriptions.Item>
    </Descriptions>
  );
}

带边框的

带边框和背景颜色列表。

import React from 'react';
import { Descriptions, Badge } from 'uiw';

export default function Demo() {
  return(
    <Descriptions title="详细信息" bordered>
      <Descriptions.Item label="项目">UI组件库</Descriptions.Item>
      <Descriptions.Item label="是否收费">免费</Descriptions.Item>
      <Descriptions.Item label="是否持续维护">是</Descriptions.Item>
      <Descriptions.Item label="创建时间">2018-04-24 18:00:00</Descriptions.Item>
      <Descriptions.Item label="更新时间" span={2}>
        2019-04-24 18:00:00
      </Descriptions.Item>
      <Descriptions.Item label="状态" span={3}>
        <Badge color="#008EF0" processing> 正在运行中</Badge>
      </Descriptions.Item>
      <Descriptions.Item label="定制组件">¥280.00</Descriptions.Item>
      <Descriptions.Item label="远程协助">¥20.00</Descriptions.Item>
      <Descriptions.Item label="修复bug">¥60.00</Descriptions.Item>
      <Descriptions.Item label="详细说明">
        五十多个组件库
        <br />
        当前版本 3.4.1
        <br />
        当前 react 版本 >= 16.7.0
      </Descriptions.Item>
    </Descriptions>
  );
}

自定义尺寸

自定义尺寸,适应在各种容器中展示。

import React from 'react';
import { Descriptions, Divider, Badge, Radio, RadioGroup } from 'uiw';

class Demo extends React.Component {
  constructor() {
    super();
    this.state = {
      value: 'default',
    }
  }
  onChange(e) {
    this.setState({
      value: e.target.value,
    });
  }
  render() {
    return (
      <div>
        <RadioGroup value={this.state.value} onChange={this.onChange.bind(this)}>
          <Radio value="default">默认(default)</Radio>
          <Radio value="large">大尺寸(large)</Radio>
          <Radio value="small">小尺寸(small)</Radio>
        </RadioGroup>
        <Divider />
        <Descriptions bordered title="详细信息"  size={this.state.value}>
          <Descriptions.Item label="项目">UI组件库</Descriptions.Item>
          <Descriptions.Item label="是否收费">免费</Descriptions.Item>
          <Descriptions.Item label="是否持续维护">是</Descriptions.Item>
          <Descriptions.Item label="创建时间">2018-04-24 18:00:00</Descriptions.Item>
          <Descriptions.Item label="更新时间" span={2}>
            2019-04-24 18:00:00
          </Descriptions.Item>
          <Descriptions.Item label="状态" span={3}>
            <Badge color="#008EF0" processing> 正在运行中</Badge>
          </Descriptions.Item>
          <Descriptions.Item label="定制组件">¥280.00</Descriptions.Item>
          <Descriptions.Item label="远程协助">¥20.00</Descriptions.Item>
          <Descriptions.Item label="修复bug">¥60.00</Descriptions.Item>
          <Descriptions.Item label="详细说明">
            五十多个组件库
            <br />
            当前版本 3.4.1
            <br />
            当前 react 版本 >= 16.7.0
          </Descriptions.Item>
        </Descriptions>
        <Divider />
        <Descriptions title="自定义尺寸"  size={this.state.value}>
          <Descriptions.Item label="姓名">调调</Descriptions.Item>
          <Descriptions.Item label="手机号码">1360000000</Descriptions.Item>
          <Descriptions.Item label="居住地">上海市,青浦区</Descriptions.Item>
          <Descriptions.Item label="备注">-</Descriptions.Item>
          <Descriptions.Item label="地址">
            中国湖北省黄冈市罗田县666号
          </Descriptions.Item>
        </Descriptions>
      </div>
    )
  }
}
export default Demo;

垂直

垂直的列表。

import React from 'react';
import { Descriptions, Divider } from 'uiw';

export default function Demo() {
  return(
    <>
      <Descriptions title="垂直的列表" layout="vertical">
        <Descriptions.Item label="姓名">调调</Descriptions.Item>
        <Descriptions.Item label="手机号码">1360000000</Descriptions.Item>
        <Descriptions.Item label="居住地">上海市,青浦区</Descriptions.Item>
        <Descriptions.Item label="备注">垂直列表设置 layout 值为 vertical。</Descriptions.Item>
        <Descriptions.Item label="地址">
          中国湖北省黄冈市罗田县666号
        </Descriptions.Item>
      </Descriptions>
      <Divider />
      <Descriptions title="垂直的列表" layout="vertical" bordered>
        <Descriptions.Item label="姓名">调调</Descriptions.Item>
        <Descriptions.Item label="手机号码">1360000000</Descriptions.Item>
        <Descriptions.Item label="居住地">上海市,青浦区</Descriptions.Item>
        <Descriptions.Item label="备注">垂直列表设置 layout 值为 vertical。</Descriptions.Item>
        <Descriptions.Item label="地址">
          中国湖北省黄冈市罗田县666号
        </Descriptions.Item>
      </Descriptions>
    </>
  );
}

Props

Descriptions

| 参数 | 说明 | 类型 | 默认值 | | ---- | ---- | ---- | ---- | | title | 标题 | ReactNode | - | | bordered | 是否展示边框 | boolean | false | | colon | 类容表述 label 添加 : 冒号 | boolean | true | | size | 设置列表的大小。设置 bordered={ture} 生效。 | large, small, default | default | | layout | 描述布局 | horizontal, vertical | horizontal | | column | 一行的 DescriptionItems 数量 | Number | 3 |

Descriptions.Item

| 参数 | 说明 | 类型 | 默认值 | | ---- | ---- | ---- | ---- | | label | 内容的描述 | ReactNode | - | | span | 包含列的数量 | Number | 1 |