프로젝트
GitHub에서 보기
ssbeefeater/react-typed
소개
typed.js를 위한 React 래퍼입니다.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalreact-typed
A react wrapper for typed.js
react-typed v2 changelog
- Rewrite in typescript
- Support for react 18
- option to start animation only when the element is visible
- new property parseRef for supporting custom components that handles ref differently (see last example)
- update docs with latest storybook version
Installation
yarn add react-typed
#or
npm install react-typed --save
Examples
import { ReactTyped } from "react-typed";
const MyComponent = () => (
<div>
<ReactTyped strings={["Here you can find anything"]} typeSpeed={40} />
<br />
<ReactTyped
strings={[
"Search for products",
"Search for categories",
"Search for brands",
]}
typeSpeed={40}
backSpeed={50}
attr="placeholder"
loop
>
<input type="text" />
</ReactTyped>
</div>
);
Using typed start, stop, toggle, destroy, reset functions
import { ReactTyped,Typed } from "react-typed";
const MyComponent {
const [typed,setTyped] = React.useState<Typed| undefined>()
return (
<div>
<Button onClick={typed.start()}>Start</Button>
<Button onClick={typed.stop()}>Stop</Button>
<Button onClick={typed.toggle()}>Toggle</Button>
<Button onClick={typed.destroy()}>Destroy</Button>
<Button onClick={typed.reset()}>Reset</Button>
<ReactTyped
typedRef={setTyped}
strings={["Here you can find anything"]}
typeSpeed={40}
/>
</div>
)
}
Start only if is visible in the dom
import { ReactTyped } from "react-typed";
const MyComponent = () => (
<ReactTyped
startWhenVisible
strings={[
"If <strong>startWhenVisible</strong> is <strong>true</strong>, will start when is visible in the dom",
]}
typeSpeed={40}
/>
);
Using parseRef for custom components
import { ReactTyped } from "react-typed";
import { Input } from "antd";
const MyComponent = () => (
<ReactTyped parseRef={(ref) => ref.current.input} attr="placeholder" strings={["Add a name here"]} typeSpeed={40} >
<Input>
</ReactTyped>
);
관련 프로젝트 살펴보기
불러오는 중…