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

@wedgekit/input

v2.3.0

Published

## Purpose

Downloads

162

Readme

@wedgekit/input

Purpose

The Input component is a styled, slightly opinionated wrapper around an HTML input where the user can enter data.

Basic Implementation

import Input from '@wedgekit/core';

const Example = () => {
  const [value, setValue] = React.useState('');

  return <Input label="Input Component Example" value={value} onChange={setValue} />;
};

render(<Example />);

Props

In addition to the props listed below, all native and React HTML attributes will be passed through.

label

Type: string

Required: ✅

A label is required for all Wedgekit inputs. If you do not want to display the label, you can use labelHidden.

value

Type: string

Required: ✅

Used in conjunction with onChange to control the value of the input externally.

onChange

Type: onChange: (value: string, name: string, event: SyntheticEvent<HTMLInputElement>) => void

Required: ✅

Called when the value of the input has changed. Allows for externally controlling the component; as well as any desired side effects.

className

Type: string

Required: ❌

This is exposed but is only here so that styled-components will be able to style components correctly. Please do not use this unless you really know what you are doing.

disabled

Type: boolean

Required: ❌

Specifies styling and disabled the text input. Disabled elements aren't editable or selectable/focusable, and their data will not be submitted with the form.

forwardedRef

Type: React.Ref

Required: ❌

The forwarded ref giving a user access to the underlying HTML input.

fullWidth

Type: boolean

Required: ❌

Indicates whether the input should span the full width of the parent element

id

Type: `string'

Required: ❌

An ID which will be passed to the underlying HTML element.

info

Type InfoObject

Required: ❌

An object which is necessary if you want to display an info button for the input.

invalid

Type: boolean

Required: ❌

No longer supported. Instead pass 'status'="error" To be removed in v3.0.0

labelHidden

Type: boolean

Required: ❌

Indicates whether to visibly display the label. The label will always be available to users of screen readers via aria-label.

labelInline

Type: boolean

Required: ❌

Indicates whether the input's label will display inline with it to its left

placeholder

Type: string

Required: ❌

Text that appears in the input when it has no value set

readOnly

Type: boolean

Required: ❌

Specifies styling and renders the input as read only. Read only elements can be tabbed through/focused. Their data isn't editable, but it will be submitted with the form. Read only is only supported for input and input wrapping components.

renderIcon

Type: () => JSX.Element

Required: ❌

A render prop for optionally displaying an icon within the input.


<Input

  {...props}

  renderIcon={() => (

    <InteracticeWrapper onClick={() => { console.log('do something')}}> // an interactive wrapper is optional

      <Icon>my_icon</Icon>

    </InteractiveWrapper>

  )}

/>

Please note that the input handles the icon's sizing, and it is not reccomended to surround the icon with an <IconWidth/> tag. The icon will be resized to have a max height and width of 15px.

required

Type: boolean

Required: ❌

Indicates whether the input is required

status

Type: 'default' | 'error' | 'success' | 'pending'

Required: ❌

Indicates form validation status - affects input style only

tabIndex

Type: number

Required: ❌

Property used to really font keyboard users

onBlur

Type: (event: SyntheticEvent<*>) => void

Required: ❌

An optional callback when focus leaves the input

onFocus

Type: (event: SyntheticEvent<*>) => void

Required: ❌

An optional callback when the input is focused

onKeyDown

Type: (event: SyntheticEvent<*>) => void

Required: ❌

An optional callback when a key is pressed

onSubmit

Type: (value: string, event: SyntheticEvent<HTMLButtonElement>) => void

Required: ❌

An optional callback when the user hits 'Enter' while focused in the input

Other Components