Convert Figma logo to code with AI

jquense logoreact-widgets

Polished, feature rich, accessible form inputs built with React

2,338
395
2,338
53

Top Related Projects

React Calendar

The Select Component for React.js

An easily internationalizable, mobile-friendly datepicker library for the web

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.

Bootstrap components built with React

Accessible modal dialog component for React

Quick Overview

React Widgets is a set of customizable form inputs and UI components for React applications. It provides a collection of accessible, themeable, and localized widgets that can be easily integrated into React projects, offering a range of form controls and interactive elements.

Pros

  • Comprehensive set of customizable UI components
  • Accessible and ARIA-compliant out of the box
  • Supports theming and localization
  • Well-documented with examples and API references

Cons

  • Large bundle size compared to more lightweight alternatives
  • Some components may have a steeper learning curve for beginners
  • Limited built-in styling options, requiring additional CSS customization
  • Less frequent updates compared to some other UI libraries

Code Examples

  1. Using the DatePicker component:
import { DatePicker } from 'react-widgets';

function MyDatePicker() {
  return (
    <DatePicker
      defaultValue={new Date()}
      onChange={value => console.log('Selected date:', value)}
    />
  );
}
  1. Creating a Dropdown component:
import { DropdownList } from 'react-widgets';

const colors = ['Red', 'Green', 'Blue'];

function MyDropdown() {
  return (
    <DropdownList
      data={colors}
      defaultValue="Green"
      onChange={value => console.log('Selected color:', value)}
    />
  );
}
  1. Implementing a NumberPicker component:
import { NumberPicker } from 'react-widgets';

function MyNumberPicker() {
  return (
    <NumberPicker
      min={0}
      max={100}
      step={5}
      defaultValue={50}
      onChange={value => console.log('Selected number:', value)}
    />
  );
}

Getting Started

To use React Widgets in your project, follow these steps:

  1. Install the package:
npm install react-widgets
  1. Import the CSS file in your main application file:
import 'react-widgets/styles.css';
  1. Import and use the components in your React components:
import { DatePicker, DropdownList, NumberPicker } from 'react-widgets';

function MyForm() {
  return (
    <div>
      <DatePicker />
      <DropdownList data={['Option 1', 'Option 2', 'Option 3']} />
      <NumberPicker />
    </div>
  );
}

Now you can start using React Widgets components in your application. Refer to the official documentation for more detailed information on each component's props and usage.

Competitor Comparisons

React Calendar

Pros of Calendar

  • More focused and lightweight, specifically designed for calendar functionality
  • Better integration with other React Component libraries
  • More frequent updates and active maintenance

Cons of Calendar

  • Less comprehensive set of UI components compared to React Widgets
  • May require additional libraries for a complete UI solution
  • Steeper learning curve for developers new to React Component ecosystem

Code Comparison

React Widgets:

import { Calendar } from 'react-widgets'

<Calendar
  defaultValue={new Date()}
  onChange={value => console.log('Date changed:', value)}
/>

Calendar:

import Calendar from 'rc-calendar'

<Calendar
  defaultValue={moment()}
  onSelect={(date) => console.log('Selected date:', date)}
/>

Summary

Calendar is a more specialized and lightweight option for calendar functionality, while React Widgets offers a broader range of UI components. Calendar integrates well with other React Component libraries but may require additional setup for a complete UI solution. React Widgets provides a more comprehensive set of components out of the box but may be less flexible for specific calendar needs. The choice between the two depends on the project requirements and the developer's familiarity with each ecosystem.

The Select Component for React.js

Pros of react-select

  • More extensive customization options and theming capabilities
  • Better support for asynchronous data loading and pagination
  • Larger community and more frequent updates

Cons of react-select

  • Steeper learning curve due to more complex API
  • Larger bundle size, which may impact performance in some applications

Code Comparison

react-select:

import Select from 'react-select';

const options = [
  { value: 'chocolate', label: 'Chocolate' },
  { value: 'strawberry', label: 'Strawberry' },
  { value: 'vanilla', label: 'Vanilla' }
];

<Select options={options} />

react-widgets:

import { DropdownList } from 'react-widgets';

const options = ['Chocolate', 'Strawberry', 'Vanilla'];

<DropdownList data={options} />

Summary

react-select offers more advanced features and customization options, making it suitable for complex use cases. However, this comes at the cost of a steeper learning curve and larger bundle size. react-widgets provides a simpler API and smaller bundle size, which may be preferable for simpler applications or those with strict performance requirements.

Both libraries offer similar core functionality, but react-select's extensive ecosystem and frequent updates give it an edge for projects that require advanced features or long-term maintenance. The choice between the two ultimately depends on the specific needs of your project and the level of complexity you're willing to manage.

An easily internationalizable, mobile-friendly datepicker library for the web

Pros of react-dates

  • Specialized focus on date-related components, offering a more comprehensive set of date-picking features
  • Extensive customization options for styling and behavior
  • Strong support for internationalization and localization

Cons of react-dates

  • Larger bundle size due to its comprehensive feature set
  • Steeper learning curve for basic implementations
  • Less versatile compared to react-widgets, which offers a broader range of input types

Code Comparison

react-dates:

import { DateRangePicker } from 'react-dates';

<DateRangePicker
  startDate={this.state.startDate}
  endDate={this.state.endDate}
  onDatesChange={({ startDate, endDate }) => this.setState({ startDate, endDate })}
  focusedInput={this.state.focusedInput}
  onFocusChange={focusedInput => this.setState({ focusedInput })}
/>

react-widgets:

import { DateTimePicker } from 'react-widgets';

<DateTimePicker
  value={this.state.date}
  onChange={date => this.setState({ date })}
  format="MM/DD/YYYY"
/>

The code comparison shows that react-dates offers a more specialized DateRangePicker component with built-in start and end date handling, while react-widgets provides a more general-purpose DateTimePicker. react-dates requires more setup for state management, whereas react-widgets has a simpler API for basic date picking functionality.

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.

Pros of Material-UI

  • Larger ecosystem with more components and extensive documentation
  • Better theming support and customization options
  • Higher adoption rate and community support

Cons of Material-UI

  • Steeper learning curve due to more complex API
  • Larger bundle size, which may impact performance
  • Opinionated design system that may not fit all projects

Code Comparison

Material-UI:

import { Button, TextField } from '@mui/material';

<Button variant="contained" color="primary">
  Click me
</Button>
<TextField label="Enter text" variant="outlined" />

React Widgets:

import { Button, TextInput } from 'react-widgets';

<Button>Click me</Button>
<TextInput placeholder="Enter text" />

Summary

Material-UI offers a more comprehensive set of components and better customization options, but comes with a steeper learning curve and larger bundle size. React Widgets provides a simpler API and lighter-weight solution, but with fewer components and less extensive documentation. The choice between the two depends on project requirements, team expertise, and design preferences.

Bootstrap components built with React

Pros of React Bootstrap

  • Larger community and more frequent updates
  • Comprehensive set of components based on Bootstrap
  • Extensive documentation and examples

Cons of React Bootstrap

  • Heavier bundle size due to Bootstrap dependency
  • Less flexibility in customization compared to React Widgets
  • Steeper learning curve for those unfamiliar with Bootstrap

Code Comparison

React Bootstrap:

import { Button, Alert } from 'react-bootstrap';

function MyComponent() {
  return (
    <div>
      <Button variant="primary">Click me</Button>
      <Alert variant="success">Success message</Alert>
    </div>
  );
}

React Widgets:

import { Button, DropdownList } from 'react-widgets';

function MyComponent() {
  return (
    <div>
      <Button>Click me</Button>
      <DropdownList data={['Option 1', 'Option 2', 'Option 3']} />
    </div>
  );
}

React Bootstrap offers a more Bootstrap-like syntax and styling, while React Widgets provides a simpler API for certain components. React Bootstrap's extensive component library and Bootstrap integration make it suitable for projects requiring a comprehensive UI framework. React Widgets, on the other hand, offers a lighter-weight solution with more focused components, making it ideal for projects that need specific UI elements without the full Bootstrap ecosystem.

Accessible modal dialog component for React

Pros of react-modal

  • Focused specifically on modal functionality, providing a lightweight and specialized solution
  • Extensive accessibility features, including ARIA attributes and keyboard navigation
  • Highly customizable with various props for styling and behavior

Cons of react-modal

  • Limited to modal functionality, unlike react-widgets which offers a broader set of UI components
  • May require additional setup for more complex modal scenarios or advanced animations
  • Less frequent updates and potentially slower bug fixes compared to react-widgets

Code Comparison

react-modal:

import Modal from 'react-modal';

<Modal
  isOpen={modalIsOpen}
  onRequestClose={closeModal}
  contentLabel="Example Modal"
>
  <h2>Modal Content</h2>
  <button onClick={closeModal}>Close</button>
</Modal>

react-widgets:

import { Popup } from 'react-widgets';

<Popup
  open={popupIsOpen}
  onClose={closePopup}
>
  <Popup.Body>
    <h2>Popup Content</h2>
    <button onClick={closePopup}>Close</button>
  </Popup.Body>
</Popup>

While react-modal focuses solely on modal functionality, react-widgets offers a more comprehensive set of UI components, including modals/popups. react-modal provides a simpler API for basic modal needs, while react-widgets offers more flexibility for complex UI scenarios. The choice between the two depends on whether you need a specialized modal solution or a broader set of UI components for your project.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

react-widgets

NPM version Downloads

An à la carte set of polished, extensible, and accessible form inputs built for React. Get going quickly with the low friction setup!

Demos and Documentation here

Local development and contributing

React widgets, uses a "monorepo" organization style for managing multiple npm packages in a single git repo. This is done through a Yarn feature called workspaces. To get everything setup and dependencies installed:

  • make sure you have the latest version of yarn installed
  • run yarn run bootstrap in the repo root directory

Install

npm install react-widgets

Running the doc site locally

  • Follow the steps above
  • switch to the www directory and run yarn
  • yarn start to start the site

NPM DownloadsLast 30 Days