Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit 9890068

Browse files
committed
docs(readme): update readme
1 parent 703e5ee commit 9890068

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

README.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,16 @@ $ yarn add react-semantic-render
4545

4646
## Usage
4747

48-
**Show**
48+
### Show
4949

5050
Renders content if `when` equals true.
5151

52+
| Property | Type | Description
53+
|---|---|---|---|---|
54+
| `when` | boolean | Conditional statement
55+
| `render` | function | Shorthand for primary content
56+
| `children` | node | Primary content
57+
5258
```jsx
5359
import { Show } from 'react-semantic-render';
5460

@@ -69,10 +75,16 @@ import { Show } from 'react-semantic-render'
6975
/>
7076
```
7177

72-
**List**
78+
### List
7379

7480
Renders content from specified callback function from either `render` or `children` on each element of `items`.
7581

82+
| Property | Type | Description
83+
|---|---|---|---|---|
84+
| `items` | any[] | Array to map
85+
| `render` | function | Shorthand for primary content
86+
| `children` | node | Primary content
87+
7688
```jsx
7789
import { List } from 'react-semantic-render'
7890

@@ -83,10 +95,15 @@ import { List } from 'react-semantic-render'
8395
</List>
8496
```
8597

86-
**Switch**
98+
### Switch
8799

88100
Renders content from first `Switch.Case` that matches `value`, else `Switch.Default` if it exists.
89101

102+
| Property | Type | Description
103+
|---|---|---|---|---|
104+
| `value` | boolean | Conditional statement
105+
| `children` | node | Primary content
106+
90107
```jsx
91108
import { Switch } from 'react-semantic-render'
92109

@@ -100,10 +117,16 @@ import { Switch } from 'react-semantic-render'
100117
</Switch>
101118
```
102119

103-
**ShowIfElse**
120+
### ShowIfElse
104121

105122
Renders content from if when condition equals true, else renders content from else.
106123

124+
| Property | Type | Description
125+
|---|---|---|---|---|
126+
| `condition` | boolean | Conditional statement
127+
| `if` | function | Renders when condition is true
128+
| `else` | function | Renders when condition is false
129+
107130
```jsx
108131
import { ShowIfElse } from 'react-semantic-render'
109132

@@ -118,10 +141,14 @@ import { ShowIfElse } from 'react-semantic-render'
118141
/>
119142
```
120143

121-
**Hideable**
144+
### Hideable
122145

123146
Higher order component that injects 'hide' prop into specified component.
124147

148+
| Property | Type | Description
149+
|---|---|---|---|---|
150+
| `hide` | boolean | Conditional statement
151+
125152
```jsx
126153
import { Hideable } from 'react-semantic-render'
127154
import { Button } from './components'

src/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ declare module 'react-semantic-render/Hideable' {
104104
}
105105

106106
/**
107-
* Higher order component that injects 'hideComponent' prop into specified component.
107+
* Higher order component that injects 'hide' prop into specified component.
108108
*/
109109
const Hideable: <P extends object>(
110110
WrappedComponent: React.ComponentType<P>,

0 commit comments

Comments
 (0)