Skip to content

Commit ba0b583

Browse files
committed
docs: add <ToggleAndDisplayPattern />
1 parent 4c3a37d commit ba0b583

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Install with [npm](https://www.npmjs.com/):
1212

1313
`react-toggle-pattern` provide three components.
1414

15+
### Insert and Remove pattens
16+
1517
- `<TogglePattern />` or pattern. This is same with `<ToggleOrPattern />`
1618
- `<ToggleOrPattern />` or pattern
1719
- `<ToggleAndPattern />` and pattern
@@ -175,7 +177,7 @@ Result to `<div class="TogglePattern ToggleOrPattern"><div>Visible</div><div>Hid
175177

176178
And match
177179

178-
````js
180+
```js
179181
<ToggleAndPattern pattern1={1} pattern2={2}>
180182
<ComponentX pattern1={1} pattern2={2}/>
181183
<ComponentY pattern1={1} />
@@ -185,6 +187,27 @@ And match
185187
Result to `<ComponentX pattern1={1} pattern2={2}/>`.
186188

187189

190+
### Show and Hide pattern
191+
192+
It is an experimental pattern.
193+
194+
- `<ToggleAndDisplayPattern />`
195+
196+
It has same interface `<ToggleAndPattern />`, but it has difference logic.
197+
198+
- It use `hidden` attribute for non-showing element.
199+
- You should add `[hidden]{ display: none!important; };` to own css.
200+
- It always wrapped children components with `<div class="ToggleAndDisplayPattern">{children}</ToggleAndDisplayPattern>`
201+
202+
**Props**
203+
204+
- `<ToggleAndDisplayPattern />` try to preserve your focus.
205+
- `<ToggleAndPattern />` missing focus because of inserting and removing.
206+
207+
**Cons**
208+
209+
- Automatically wrap `{this.props.children}` with `div` element.
210+
188211
## Changelog
189212

190213
See [Releases page](https://github.com/azu/react-toggle-pattern/releases).

0 commit comments

Comments
 (0)