npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@veksa/fela

v0.0.8

Published

[![npm version](https://img.shields.io/npm/v/@veksa/fela.svg?style=flat-square)](https://www.npmjs.com/package/@veksa/fela) [![npm downloads](https://img.shields.io/npm/dm/@veksa/fela.svg?style=flat-square)](https://www.npmjs.com/package/@veksa/fela) [!

Readme

@veksa/fela

npm version npm downloads license

A wrapper around Fela for React components with TypeScript support, providing enhanced styling capabilities with reusable rules, theme support, and performance optimizations.

Installation

@veksa/fela requires TypeScript 5.8 or later.

Using npm or yarn

# npm
npm install @veksa/fela

# yarn
yarn add @veksa/fela

Features

  • TypeScript Support: Full TypeScript integration for better developer experience
  • Reusable Style Rules: Create reusable style rules with createRules
  • React Hooks: Easy integration with React components using useStyle
  • Theme Support: Access theme variables in your styles
  • Style Extension: Extend styles through props
  • Performance Optimizations: Built-in caching for better performance

Basic Usage

Setting up the Fela Provider

import React from 'react';
import { createRenderer } from 'fela';
import { RendererProvider, ThemeProvider } from 'react-fela';
import { FelaRendererContext } from '@veksa/fela';

const renderer = createRenderer();
const theme = { primaryColor: '#007bff', secondaryColor: '#6c757d' };

const App = () => (
  <ThemeProvider theme={theme}>
    <FelaRendererContext.Provider value={renderer}>
      <YourComponent />
    </FelaRendererContext.Provider>
  </ThemeProvider>
);

Creating Style Rules

import { createRules, IRuleFn } from '@veksa/fela';
import { IStyle } from 'fela';

// Define your props interface
interface ButtonProps {
  primary?: boolean;
  disabled?: boolean;
}

// Define your theme interface
interface Theme {
  primaryColor: string;
  secondaryColor: string;
}

// Create style rules
const buttonRules: IRuleFn<{
  root: IStyle;
  label: IStyle;
}, ButtonProps, Theme, IStyle> = (props, renderer) => {
  const { primary, disabled, theme } = props;
  
  return {
    root: {
      padding: '10px 15px',
      borderRadius: '4px',
      backgroundColor: primary ? theme.primaryColor : theme.secondaryColor,
      color: '#fff',
      cursor: disabled ? 'not-allowed' : 'pointer',
      opacity: disabled ? 0.7 : 1,
      transition: 'all 0.3s ease',
      '&:hover': {
        opacity: disabled ? 0.7 : 0.9,
      },
    },
    label: {
      fontSize: '14px',
      fontWeight: 'bold',
    },
  };
};

// Create the reusable style
export const useButtonStyle = createRules(buttonRules);

Using the Style in Components

import React from 'react';
import { useStyle } from '@veksa/fela';
import { useButtonStyle } from './buttonStyles';

interface ButtonProps {
  primary?: boolean;
  disabled?: boolean;
  children: React.ReactNode;
  onClick?: () => void;
}

const Button: React.FC<ButtonProps> = ({ primary, disabled, children, onClick }) => {
  // Apply the styles
  const { css } = useStyle(useButtonStyle, { primary, disabled });
  
  return (
    <button className={css.root} onClick={onClick} disabled={disabled}>
      <span className={css.label}>{children}</span>
    </button>
  );
};

export default Button;

Extending Styles

import React from 'react';
import { useStyle, IExtendProp } from '@veksa/fela';
import { useButtonStyle } from './buttonStyles';

interface CustomButtonProps extends IExtendProp<typeof useButtonStyle> {
  primary?: boolean;
  disabled?: boolean;
  children: React.ReactNode;
  onClick?: () => void;
}

const CustomButton: React.FC<CustomButtonProps> = ({ primary, disabled, children, onClick, extend }) => {
  // Apply the styles with extensions
  const { css } = useStyle(useButtonStyle, { 
    primary, 
    disabled,
    extend: {
      // Extend the root style
      root: {
        name: 'customButton',
        rule: {
          borderRadius: '8px',
          boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
        }
      },
      // You can extend other rules as well
      ...extend
    }
  });
  
  return (
    <button className={css.root} onClick={onClick} disabled={disabled}>
      <span className={css.label}>{children}</span>
    </button>
  );
};

export default CustomButton;

Contributing

This project welcomes contributions and suggestions.

License

MIT