react-levels-chart
v1.0.2
Published
[](https://www.npmjs.com/package/react-levels-chart) [](https://www.npmjs.com/package/react-levels-chart) [ => {
return (
<Radar
username="engineer.name"
levels={{
Technology: 'Specializes',
System: 'Owns',
People: 'Mentors',
Process: 'Challenges',
Influence: 'Multiple Teams'
}}
/>
);
};API Reference
Radar Props
interface RadarProps {
username: string;
levels?: SelectedLevels;
}
type Category = 'Technology' | 'System' | 'People' | 'Process' | 'Influence';
type SelectedLevels = {
[key in Category]: string;
}| Prop | Type | Required | Description | |------|------|----------|-------------| | username | string | Yes | Unique identifier for local storage sync | | levels | SelectedLevels | No | Initial levels for each category |
Default Levels
The component comes with predefined progression levels for each category:
const levelMap = {
Technology: ['Adopts', 'Specializes', 'Evangelizes', 'Masters', 'Creates'],
System: ['Enhances', 'Designs', 'Owns', 'Evolves', 'Leads'],
People: ['Learns', 'Supports', 'Mentors', 'Coordinates', 'Manages'],
Process: ['Follows', 'Enforces', 'Challenges', 'Adjusts', 'Defines'],
Influence: ['Subsystem', 'Team', 'Multiple Teams', 'Company', 'Community']
}Styling
The component supports comprehensive style customization through the Controls component:
interface StyleConfig {
form?: React.CSSProperties;
fieldset?: React.CSSProperties;
controlsContainer?: React.CSSProperties;
controlWrapper?: React.CSSProperties;
label?: React.CSSProperties;
selectWrapper?: React.CSSProperties;
select?: React.CSSProperties;
customDropdownArrow?: {
url: string;
width?: number;
height?: number;
position?: {
right?: number | string;
top?: number | string;
};
};
}Example Style Customization
const customStyles: StyleConfig = {
controlsContainer: {
gap: '24px',
marginTop: '32px'
},
select: {
borderColor: '#0066cc',
borderRadius: '8px',
padding: '12px'
},
customDropdownArrow: {
url: '/custom-arrow.svg',
width: 12,
height: 8
}
};
<Controls
categories={categories}
selectedLevels={selectedLevels}
handleLevelChange={handleLevelChange}
levelMap={levelMap}
styles={customStyles}
scrollable={true}
/>Development
Setup
# Install dependencies
npm install
# Start development server
npm start
# Build the package
npm run build
# Run tests
npm test
# Generate coverage report
npm run coverageTesting
The project uses Vitest for testing. Tests can be run with:
npm testFor coverage reports:
npm run coverageContributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Inspired by the engineering ladders framework.
