+
+ {prefixIcon && {prefixIcon}}
+ {clearable && value?.length ? (
+
+ ) : null}
{styles}
)
@@ -209,6 +278,8 @@ Input.propTypes = {
/** The [native `autocomplete` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autocomplete) */
autoComplete: PropTypes.string,
className: PropTypes.string,
+ /** Makes the input field clearable */
+ clearable: PropTypes.bool,
dataTest: PropTypes.string,
/** Makes the input smaller */
dense: PropTypes.bool,
@@ -228,6 +299,8 @@ Input.propTypes = {
name: PropTypes.string,
/** Placeholder text for the input */
placeholder: PropTypes.string,
+ /** Add prefix icon */
+ prefixIcon: PropTypes.element,
/** Makes the input read-only */
readOnly: PropTypes.bool,
/** Sets a role attribute on the input */
@@ -243,6 +316,8 @@ Input.propTypes = {
value: PropTypes.string,
/** Applies 'warning' appearance for validation feedback. Mutually exclusive with `valid` and `error` props */
warning: sharedPropTypes.statusPropType,
+ /** Defines the width of the input. Can be any valid CSS measurement */
+ width: PropTypes.string,
/** Called with signature `({ name: string, value: string }, event)` */
onBlur: PropTypes.func,
/** Called with signature `({ name: string, value: string }, event)` */
diff --git a/components/input/types/index.d.ts b/components/input/types/index.d.ts
index e9bca202d9..ed135286b9 100644
--- a/components/input/types/index.d.ts
+++ b/components/input/types/index.d.ts
@@ -41,6 +41,10 @@ export interface InputProps {
*/
autoComplete?: string
className?: string
+ /**
+ * Makes the input clearable
+ */
+ clearable?: boolean
dataTest?: string
/**
* Makes the input smaller
@@ -78,6 +82,10 @@ export interface InputProps {
* Placeholder text for the input
*/
placeholder?: string
+ /**
+ * Add prefix icon
+ */
+ prefixIcon?: Element
/**
* Makes the input read-only
*/
@@ -135,6 +143,10 @@ export interface InputFieldProps {
*/
autoComplete?: string
className?: string
+ /**
+ * Makes the input field clearable
+ */
+ clearable?: boolean
dataTest?: string
/**
* Makes the input smaller
@@ -184,6 +196,10 @@ export interface InputFieldProps {
* Placeholder text for the input
*/
placeholder?: string
+ /**
+ * Add prefix icon to input
+ */
+ prefixIcon?: Element
/**
* Makes the input read-only
*/