Skip to content

Commit

Permalink
docs: Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JelenaTakac committed Aug 22, 2024
1 parent ddeec64 commit 7fc2e6d
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/components/input/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Easily create input with different styles using this component based on React an
### type
- **Type:** `string`
- **Default:** `"text"`
- **Description:** Type of the input input field - tel/number/url/email/text/password
- **Description:** Type of the input field - tel/number/url/email/text/password/file

### value
- **Type:** `string`
- **Default:** `""`
- **Description:** Value of the input input field
- **Description:** The value of the input field. Not applicable for `type="file"`.

### size
- **Type:** `string`
Expand All @@ -31,10 +31,27 @@ Easily create input with different styles using this component based on React an
### disabled
- **Type:** `boolean`
- **Default:** `false`
- **Description:** Disabled State of the text area
- **Description:** Disabled State of the input field
- `true`
- `false`

### onChange
- **Type:** `function`
- **Description:** Callback function triggered when the input value changes. For `type="file"`, it returns the selected file(s).

### error
- **Type:** `boolean`
- **Default:** `false`
- **Description:** If true, applies error styles to the input.

### prefix
- **Type:** `ReactNode`
- **Description:** A prefix icon or element that appears inside the input field.

### suffix
- **Type:** `ReactNode`
- **Description:** A suffix icon or element that appears inside the input field.

### inputProps
- **Type:** `object`
- **Description:** Any additional props will be spread onto the input element. Ex, given below
Expand All @@ -43,6 +60,12 @@ Easily create input with different styles using this component based on React an
- `cols`
- `rows`

## File Input Behavior
- When `type="file"` is specified:
- The default text "No file chosen" is replaced with the name of the selected file.
- The text color changes when a file is selected.
- The component handles file selection, and the onChange callback returns the selected file(s).

## Usage

### Basic Example
Expand All @@ -59,6 +82,7 @@ const App = () => (
}} size="sm"/>
<Input size="lg" value={textval} onChange={((e)=>{console.log(e.target.value)})}/>
<Input disabled={ true } size="md"/>
<Input type="file" size="md" onChange={handleFileChange} />
</div>
);

Expand Down

0 comments on commit 7fc2e6d

Please sign in to comment.