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 🙏

© 2024 – Pkg Stats / Ryan Hefner

readease

v0.0.7

Published

Here's the revised README with the updated explanation for `useCycleVersion`:

Downloads

7

Readme

Here's the revised README with the updated explanation for useCycleVersion:

Readease for React

Readease is a React component designed to enhance text accessibility for users. This supports features like simplified text versions, customisable themes, and accessibility-friendly fonts (such as OpenDyslexic).

Features

  • Display multiple versions of text (full and simplified).
  • Easily toggle between text versions.
  • Support for dyslexia-friendly fonts like OpenDyslexic.
  • Customisable themes using styled-components.

Installation

Install Readease as an npm package in your project.

npm install readease

Usage

Step 1: Importing and Using Readease

You can use the Readease component in your project by passing in the text, simplified text versions, and optionally customising the theme or font.

import Readease from 'readease';

function App() {
    const description = "Web accessibility refers to ensuring that people with disabilities can interact with websites on the World Wide Web.";

    const simplifiedTexts = [
        "Web accessibility means making sure everyone can use websites, even if they have disabilities or slow internet.",
        "Web accessibility ensures that websites are easy for everyone to use."
    ];

    return (
        <div>
            <h1>Accessible Text Display</h1>
            <Readease
                description={description}
                simplifiedTexts={simplifiedTexts}
                useCycleVersion={true}
                useSpeakText={true}
                customFont="OpenDyslexic"
            />
        </div>
    );
}

export default App;

Step 2: Customising the Theme

You can customise the look and feel of Readease by passing a customTheme object directly to the component.

Example of Custom Theme:

const customTheme = {
    colors: {
        background: '#f4f4f9',
        text: '#333333',
        primary: '#4A90E2',
        button: '#FFB74D',
        secondary: '#8BC34A',
        buttonHoverBg: '#FF7043',
        icon: '#FFFFFF',
        buttonHover: '#37474F',
    },
    typography: {
        fonts: {
            primary: 'Verdana, sans-serif',
            secondary: 'OpenDyslexia, sans-serif',
        },
    },
    spacing: {
        sm: '0.5rem',
        md: '1rem',
    },
    borderRadius: {
        round: '50%',
    },
};

Apply the custom theme to the Readease component:

<Readease
    description="Web accessibility means..."
    simplifiedTexts={["Simplified version 1", "Simplified version 2"]}
    customTheme={customTheme}
    useCycleVersion={true}
    useSpeakText={true}
/>

Step 3: Customising the Readease Component

You can pass various props to customise how the Readease component behaves.

  • description: The full version of the text.
  • simplifiedTexts: An array of simplified text versions.
  • useCycleVersion: A toggle to activate or deactivate the entire component (default: true). When set to false, the component is deactivated. This feature is useful if you want to toggle the component on and off, though its necessity is rare.
  • useSpeakText: Whether to enable text-to-speech functionality (default: true).
  • customFont: A custom font to apply (e.g., "OpenDyslexic").
  • customTheme: An optional theme object to override default styling.

Example:

<Readease
    description="This is the original version of the text."
    simplifiedTexts={[
        "This is a simplified version.",
        "This is an even more simplified version."
    ]}
    useCycleVersion={true}
    useSpeakText={true}
    customFont="OpenDyslexic"
    customTheme={customTheme}
/>

Conclusion

With Readease, you can easily integrate accessible text components into your React application. The customisable theme options and support for multiple text versions make it an ideal solution for improving accessibility in web applications.