1.0.9 • Published 2 years ago

react-icons-picker v1.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

React-Icons Icon Picker

Overview

react-icons-picker is a React icon picker for react-icons icons. It contains both a picker component and an icon renderer. Doesn't need any css loader. Sandbox Demo.

Icon Picker Demo

Installation

Install via npm

npm install react-icons-picker

or yarn

yarn add react-icons-picker

Usage

The IconPicker component is just like any other picker component. The value prop is the icon that is displayed on the picker. When a new icon is selected, the onChange handler is fired. You can customize the look and feel as you want by passing props or just selecting the css class.

import * as React from 'react'
import IconPicker from 'react-icons-picker'

export default () => {
  const [value, setValue] = React.useState("FaUsers")
  return (
    <IconPicker value={value} onChange={(v) => setValue(v)} />
  )
}

You can also use the IconPickerItem component to render the icon. This uses react-icons under the hood.

import * as React from 'react'
import { IconPickerItem } from 'react-icons-picker'

export default () => (
  <IconPickerItem value="FaUsers" size={24} color="#000" />
  )

All valid configurations/props of the package

IconPicker

PropTypeRequiredDescription
valuestringtrueThe current font awesome icon displayed on the picker.
onChange(v: string) => voidtrueA change handler that is executed when a new icon is selected.
modalEmptyContentReact elementfalseReact component that gets displayed when search result is empty
searchInputPlaceholderstringfalseThe placeholder text for search input
pickButtonStyleCSSPropertiesfalseStyles for the picker button
pickButtonFocusStyleCSSPropertiesfalseStyles for the picker button focus
modalFadeStyleCSSPropertiesfalseStyles for the modal window's background fade effect
modalWrapperStyleCSSPropertiesfalseStyles for the modal window's centered wrapper div
searchBarStyleCSSPropertiesfalseStyles for the search input's wrapper div element
searchInputStyleCSSPropertiesfalseStyles for the search input
searchInputFocusStyleCSSPropertiesfalseStyles for the search input's focus
modalContentWrapperStyleCSSPropertiesfalseStyles for the modal window's content wrapper div
modalIconsWrapperStyleCSSPropertiesfalseStyles for the wrapper element of search result of icons
modalIconsStyleCSSPropertiesfalseStyles for the each instance of search result of icons
modalIconNameStyleCSSPropertiesfalseStyles for the each instance of search result of icon names
modalIconsHoverStyleCSSPropertiesfalseStyles for the hovering effect of each search result icons
modalEmptyWrapperStyleCSSPropertiesfalseStyles for the wrapper element of empty search result container

IconPickerItem | Prop | Type | Required | Description | | ---- | --- | --- | --- | value | string | true | The name of the icon to render. Example: "FaUsers" | | size | number | false |The size of the icon. Default: 24 | | color | string | false | The color of the icon. Default: "#000" |

Contribution Guide

If you are interested in contributing, please submit a PR.

Contributors

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago