Skip to content

Commit

Permalink
feat(TextField): Add onBlur prop
Browse files Browse the repository at this point in the history
  • Loading branch information
giubatt committed May 7, 2021
1 parent f352082 commit 410e9b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/TextField/TextField.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @jsxRuntime classic /
/** @jsx jsx */
import { jsx } from "theme-ui"
import { ChangeEvent, forwardRef } from "react"
import { ChangeEvent, FocusEvent, forwardRef } from "react"
import Input, { InputProps } from "../Input/Input"
import Selector, { SelectorProps } from "../Selector/Selector"

Expand All @@ -14,6 +14,8 @@ export interface TextFieldProps {
value?: string
/** Callback fired when the value is changed */
onChange?: (event: ChangeEvent<HTMLInputElement>) => void
/** Callback fired when the input is unfocused */
onBlur?: (event: FocusEvent<HTMLInputElement>) => void
/** Placeholder text content */
placeholder?: string

Expand Down Expand Up @@ -51,6 +53,7 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
type = "text",
value,
onChange,
onBlur,
label,
placeholder,
disabled = false,
Expand Down Expand Up @@ -131,6 +134,7 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
value={value}
disabled={disabled}
onChange={onChange}
onBlur={onBlur}
state={state}
unit={unit}
aria-describedby={helperTextId}
Expand Down

1 comment on commit 410e9b6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for herzui ready!

✅ Preview
https://herzui-fbpb06w4j-micromed.vercel.app

Built with commit 410e9b6.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.