---
title: 文本
group:
  path: /Basic
  title: 基础组件
---

## 文本  


```jsx  
import React from 'react';  
import { Text } from '@dndc/pudge-basic';  

const props = { text: "文本"};  
const style = {
  fontSize:20,
  color:'red',
  WebkitLineClamp:2

};  
const data = {
  type:'Text',
  props,
  style
}
export default () => <Text data={data} />;  
```  

### 1.可配置style, 默认样式配置:  

属性 | 说明 |  类型  | 默认值 | 版本  
-|-|-|-|- 
alignSelf | 相对于外部容器对齐方式 | strig | center | 1.0.0  
width | 宽度 | strig | 144px | 1.0.0  
height | 高度 | strig | 300px | 1.0.0   
widthOverLayout | 是否宽度100% | bool | false | 1.0.0  
heightAuto | 高度自适应 | bool | false | 1.0.0
lineHeight | 行间距 | string | 1.5 | 1.0.0   
justifyContent | 对应flex justifyContent | string | flex-start | 1.0.0   
alignItems | 对应flex alignItems | string | flex-start | 1.0.0    
fontSize | 字体带下 | strig | 14px | 1.0.0  
textIndent | 首行缩进 | strig | 0px | 1.0.0 
color | 颜色 | strig | #333 | 1.0.0  
backgroundColor | 背景颜色 | strig | rgba(255, 255, 255, 1)| 1.0.0  
marginBottom | 底边距 | string | 0px | 1.0.0
marginTop | 上边距 | string | 0px | 1.0.0    
padding | 内边距 | array | ['15px', '15px', '15px', '15px'] | 1.0.0 
margin | 外边距 | array | ['0px', '0px', '0px', '0px'] | 1.0.0   
boxShadow | 阴影 | strig | '' | 1.0.0  
letterSpacing | 字间距 | strig | '1px' | 1.0.0
fontWeight | 字大小 | int | 400 | 1.0.0   
 
example  
```json  
 style: {  
      alignSelf: 'center',
      height: '50px',
      width: '375px',
      widthOverLayout: false,
      heightAuto: false,
      lineHeight: '1.5',
      justifyContent: 'flex-start',
      alignItems: 'flex-start',
      fontSize: '14px',
      textIndent: '0px',
      color: '#333333',
      backgroundColor: 'rgba(255, 255, 255, 1)',
      marginBottom: '0px',
      marginTop: '0px',
      padding: ['15px', '15px', '15px', '15px'],
      margin: ['0px', '0px', '0px', '0px'],
      boxShadow: '',
      letterSpacing: '1px',
      fontWeight: 400,
    }  
```  

 

### 2.默认数据配置:  
属性 | 说明 |  类型  | 默认值 | 版本  
-|-|-|-|-  
text | 文字 | strig | 按钮 | 1.0.0  
href | 链接 | strig |  | 1.0.0  

example  
```json  
 props: {  
      text: '文本框',  
      href: '',  
    }  
```  

### 3.事件API:  

属性 | 说明 |  类型  | 版本  
-|-|-|-|-  
onClick | 点击 | Fun | 1.0.0  