
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
@carefully-coded/react-text-gradient
Advanced tools
A simple static or animated text gradient react component
A simple React component for awesome, animated or static text gradients.
The library consists of a single component Text
which when wrapped
around text or a component containing text applies a gradient to it.
Install it from npm:
npm install @carefully-coded/react-text-gradient
Or with Yarn:
yarn add @carefully-coded/react-text-gradient
Add a simple static gradient to your text:
import Text from 'react-text-gradient';
...
<Text gradient={{ from: '#818CF8', to: '#5B21B6' }}>Some fancy text</Text>
Use the animateTo
prop to apply a specific gradient to animate to, or use animate
to animate between the from
and to
positions of
the initial gradient. Make sure to not set the same prop for animateTo
and gradient
or you will animate between the same color (i.e nothing will happen)
Animate between the from
and to
colors
import Text from 'react-text-gradient';
<Text
gradient={{ from: '#818CF8', to: '#5B21B6' }}
animate
animationDuration={4000}
>
Some fancy animated text
</Text>
Specific gradient to animate to:
import Text from 'react-text-gradient';
<Text
gradient={{ from: '#818CF8', to: '#5B21B6' }}
animateTo={{ to: '#818CF8', from: '#5B21B6' }}
animationDuration={4000}
>
Some fancy animated text
</Text>
Any text inside of the component will have a gradient added, so it's easy just to add a gradient by wrapping existing components.
import Text from 'react-text-gradient';
<Text
gradient={{ from: '#818CF8', to: '#5B21B6' }}
animate
animationDuration={4000}
>
<h1>Large gradient text</h1>
</Text>
Gradients are radial by default (we think this looks better most of the time). Set type
to linear
to create a linear gradient.
When adding a linear gradient, add a degree
to pick what direction the gradient should be in - this defaults to 90
.
import Text from 'react-text-gradient';
<Text
gradient={{ from: '#818CF8', to: '#5B21B6', type: 'linear', degree: 90 }}
animateTo={{ to: '#818CF8', from: '#5B21B6', degree: 120 }}
animationDuration={4000}
>
Some fancy text with a linear gradient
</Text>
Styles can be added to the text directly by specifying a style
or className
prop. Note that any background
css attribute may be overwritten
due to the applied gradient.
import Text from 'react-text-gradient';
<Text
style={{fontSize: '20px'}}
gradient={{ from: '#818CF8', to: '#5B21B6' }}
animate
animationDuration={4000}
>
Text with specific font size
</Text>
<Text />
Propstype Gradient = {
type?: 'linear' | 'radial';
from?: string;
to?: string;
degree?: number;
};
interface Props extends React.HTMLAttributes<HTMLDivElement> {
gradient: Gradient;
animate?: Boolean;
animateTo?: Gradient;
animateDuration?: number;
}
Prop Name | Type | Default | Description |
---|---|---|---|
gradient | Gradient | undefined | Starting gradient |
animate | Boolean | false | Animate the gradient text by transitioning between from and to colors |
animateTo | Gradient | undefined | Gradient to animate to |
animateDuration | number | 4000 | Duration of animation in ms |
FAQs
A simple static or animated text gradient react component
The npm package @carefully-coded/react-text-gradient receives a total of 78 weekly downloads. As such, @carefully-coded/react-text-gradient popularity was classified as not popular.
We found that @carefully-coded/react-text-gradient 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
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.