Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
react-clock
Advanced tools
An analog clock for your React app.
npm install react-clock
or yarn add react-clock
.import Clock from 'react-clock'
.<Clock />
.Minimal demo page is included in sample directory.
Online demo is also available!
Add React-Clock to your project by executing npm install react-clock
or yarn add react-clock
.
Here's an example of basic usage:
import React, { Component } from 'react';
import Clock from 'react-clock';
class MyApp extends Component {
state = {
date: new Date(),
}
componentDidMount() {
setInterval(
() => this.setState({ date: new Date() }),
1000
);
}
render() {
return (
<div>
<p>Current time:</p>
<Clock
value={this.state.date}
/>
</div>
);
}
}
If you want to use default React-Clock styling to build upon it, you can import React-Clock's styles by using:
import 'react-clock/dist/Clock.css';
Displays a complete clock.
Prop name | Description | Default value | Example values |
---|---|---|---|
className | Class name(s) that will be added along with "react-clock" to the main React-Clock <time> element. | n/a |
|
hourHandLength | Hour hand length, in %. | 50 | 80 |
hourHandOppositeLength | The length of the part of an hour hand on the opposite side the hand is pointing to, in %. | 10 | 20 |
hourHandWidth | Hour hand width, in pixels. | 4 | 3 |
hourMarksLength | Hour marks length, in %. | 10 | 8 |
hourMarksWidth | Hour marks width, in pixels. | 3 | 2 |
minuteHandLength | Minute hand length, in %. | 70 | 80 |
minuteHandOppositeLength | The length of the part of a minute hand on the opposite side the hand is pointing to, in %. | 10 | 20 |
minuteHandWidth | Minute hand width, in pixels. | 2 | 3 |
minuteMarksLength | Minute marks length, in %. | 6 | 8 |
minuteMarksWidth | Minute marks width, in pixels. | 1 | 2 |
renderHourMarks | Whether hour marks shall be rendered. | true | false |
renderMinuteHand | Whether minute hand shall be rendered. | true | false |
renderMinuteMarks | Whether minute marks shall be rendered. | true | false |
renderNumbers | Whether numbers shall be rendered. | false | true |
renderSecondHand | Whether second hand shall be rendered. | true | false |
secondHandLength | Second hand length, in %. | 90 | 80 |
secondHandOppositeLength | The length of the part of a second hand on the opposite side the hand is pointing to, in %. | 10 | 20 |
secondHandWidth | Second hand width, in pixels. | 1 | 2 |
size | Clock size, in pixels. | 150 | 250 |
value | Clock value. Must be provided. | n/a | Date: new Date() |
The MIT License.
Wojciech Maj kontakt@wojtekmaj.pl http://wojtekmaj.pl |
FAQs
An analog clock for your React app.
The npm package react-clock receives a total of 91,387 weekly downloads. As such, react-clock popularity was classified as popular.
We found that react-clock demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.