Skip to content

Commit

Permalink
Update textarea_reference.md
Browse files Browse the repository at this point in the history
  • Loading branch information
anubrag authored Jan 16, 2024
1 parent 8b84383 commit 68bfb6c
Showing 1 changed file with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
## Reference for nextpy/frontend/components/chakra/forms/textarea(Generated by a LLM. Pending Review)

# TextArea Component Documentation

## Overview

The `TextArea` component in the Nextpy library is designed to allow users to input multi-line text. It's a form control that can be useful in various scenarios where you need to collect longer, free-form text from a user, such as comments, descriptions, or feedback forms.
The `text_area` component in the Nextpy library is designed to allow users to input multi-line text. It's a form control that can be useful in various scenarios where you need to collect longer, free-form text from a user, such as comments, descriptions, or feedback forms.

## Anatomy

The `TextArea` component can be used in its simplest form or customized with various props to meet the needs of your application.
The `text_area` component can be used in its simplest form or customized with various props to meet the needs of your application.

### Basic Usage:

Here's a basic example of how to use the `TextArea` component:
Here's a basic example of how to use the `text_area` component:

```python
from nextpy.components.chakra.forms.textarea import TextArea
from nextpy.backend.vars import Var

# Creating a state variable to hold the text area value
text_area_value = Var("")

# Creating a TextArea component with binding to the state variable
text_area = TextArea.create(value=text_area_value, placeholder="Enter your text here...")
text_area_example = xt.text_area(value=text_area_value, placeholder="Enter your text here...")
```

### Advanced Usage:

For more advanced scenarios, you can customize the `TextArea` with additional props:

```python
# Customizing the TextArea with error and focus border colors, and event handlers
text_area_custom = TextArea.create(
# Customizing the text_area with error and focus border colors, and event handlers
text_area_custom = xt.text_area(
value=text_area_value,
placeholder="Enter your text here...",
error_border_color="red.500",
Expand All @@ -44,7 +36,7 @@ text_area_custom = TextArea.create(

## Components

The `TextArea` component has several properties you can use to customize its behavior and appearance:
The `text_area` component has several properties you can use to customize its behavior and appearance:

| Prop Name | Type | Description |
|---------------------|---------------------------|--------------------------------------------------------------|
Expand Down Expand Up @@ -78,5 +70,3 @@ The `TextArea` component has several properties you can use to customize its beh
- When using `variant`, choose a style that is consistent with the rest of your application for a uniform look.
- Always include the appropriate event handlers (`on_change`, `on_blur`, etc.) to manage the state and validate the user input.
- Utilize the `is_required`, `is_read_only`, and `is_disabled` props to guide user interaction based on the context of the form.

When writing documentation for Nextpy's `TextArea`, be sure to provide clear code examples, explain the purpose and usage of each prop, and offer guidance on best practices to help developers create effective and user-friendly forms in their applications.

0 comments on commit 68bfb6c

Please sign in to comment.