
Security News
Feross on TBPN: Socket's Series C and the State of Software Supply Chain Security
Feross Aboukhadijeh joins TBPN to discuss Socket's $60M Series C, 500%+ ARR growth, AI's impact on open source, and the rise in supply chain attacks.

FlowToken is a React component library designed to enhance the visual presentation of text streaming from large language models (LLMs). This library offers a variety of animations that make the text appear smoothly and dynamically, providing an engaging user experience.
Try the demo here: Demo link
FlowToken includes several key features:
Install FlowToken using npm:
npm install flowtoken
Or using yarn:
yarn add flowtoken
To use markdown, import the AnimatedMarkdown component.
import React from 'react';
import { AnimatedMarkdown } from 'flowtoken';
// import the flowtoken css in order to use the animations
import 'flowtoken/dist/styles.css';
const App = () => {
return (
<AnimatedMarkdown
content="## Hello, world!"
animation="fadeIn"
animationDuration="0.5s"
animationTimingFunction="ease-in-out"
/>
);
};
export default App;
'use client'
import { useChat } from 'ai/react'
import { AnimatedMarkdown } from 'flowtoken';
import 'flowtoken/dist/styles.css';
export default function Chat() {
const { messages, input, handleInputChange, handleSubmit } = useChat()
return (
<div>
{messages.map(m => (
<div key={m.id}>
{m.role}: <AnimatedMarkdown content={m.content}
animation="dropIn"
animationDuration="0.5s"
animationTimingFunction="ease-in-out"
/>
</div>
))}
<form onSubmit={handleSubmit}>
<label>
Say something...
<input
value={input}
onChange={handleInputChange}
/>
</label>
</form>
</div>
)
}
You can use custom components by passing a customComponents prop to the AnimatedMarkdown component where the key is xml tag (ex. MyComponent) to match and the value is the component to render. Then just prompt your LLM to output the custom component syntax and it will be rendered with your custom component.
const customComponents = {
'customcomponent': ({ animateText, node, children, ...props }: any) => {
return (
<>
{animateText(<div {...props}>{children}</div>)}
</>
)
},
}
...
<AnimatedMarkdown content="Hello, world! <customcomponent>This is a custom component</customcomponent>" customComponents={customComponents} />
This is an example of a custom component.
"word" | "char"): How to split and animate the content. Defaults to "word".null): Name of the CSS animation to apply (e.g. fadeIn, dropIn). Set to null to disable animations on completed messages.0.6s).ease, ease-in-out).200px).FlowToken supports various CSS animations:
For custom animations, define your keyframes in CSS wrap it in a class and pass the animation name to the animation prop.
/* custom-styles.css */
@keyframes custom-animation {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.custom-animation {
animation: custom-animation 1s ease-in-out;
}
import 'custom-styles.css';
...
<AnimatedMarkdown content="Hello, world!" animation="custom-animation" />
To lower the memory footprint, disable animations by setting the animation parameter to null on any completed messages.
If using tailwind with generated markdown, be sure to setup tailwind typography: https://github.com/tailwindlabs/tailwindcss-typography
and add prose lg:prose-md prose-pre:p-0 prose-pre:m-0 prose-pre:bg-transparent to your flowtoken markdown container.
Contributions are welcome! Please feel free to submit pull requests or open issues to suggest features or report bugs.
FlowToken is MIT licensed.
FAQs

The npm package flowtoken receives a total of 19,158 weekly downloads. As such, flowtoken popularity was classified as popular.
We found that flowtoken demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Feross Aboukhadijeh joins TBPN to discuss Socket's $60M Series C, 500%+ ARR growth, AI's impact on open source, and the rise in supply chain attacks.

Security News
OSV withdrew 157 OSV malware reports after automated false positives incorrectly flagged trusted npm and PyPI packages, sending bad records into tools that rely on OSV data.

Research
/Security News
TrapDoor crypto stealer hits 36 malicious packages across npm, PyPI, and Crates.io, targeting crypto, DeFi, AI, and security developers.