Skip to content

Commit 31dad76

Browse files
feat: add autofocus to ChatInput
1 parent 5f747ec commit 31dad76

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

solara/lab/components/chat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def ChatInput(
4646
send_callback: Optional[Callable[[str], None]] = None,
4747
disabled: bool = False,
4848
style: Optional[Union[str, Dict[str, str]]] = None,
49+
autofocus: bool = False,
4950
input_text_style: Optional[Union[str, Dict[str, str]]] = None,
5051
classes: List[str] = [],
5152
input_text_classes: List[str] = [],
@@ -59,6 +60,7 @@ def ChatInput(
5960
* `disabled`: Whether the input should be disabled. Useful for disabling sending further messages while a chatbot is replying,
6061
among other things.
6162
* `style`: CSS styles to apply to the `solara.Row` containing the input field and submit button. Either a string or a dictionary.
63+
* `autofocus`: Determines if a component is to be autofocused or not (Default is False). Autofocus will occur during page load and only one component per page can have autofocus active.
6264
* `input_text_style`: CSS styles to apply to the `InputText` part of the component. Either a string or a dictionary.
6365
* `classes`: A list of CSS classes to apply to the component. Also applied to the container.
6466
* `input_text_classes`: A list of CSS classes to apply to the `InputText` part of the component.
@@ -84,6 +86,7 @@ def send(*ignore_args):
8486
rounded=True,
8587
filled=True,
8688
hide_details=True,
89+
autofocus=autofocus,
8790
style_="flex-grow: 1;" + input_text_style_flat,
8891
disabled=disabled,
8992
class_=" ".join(input_text_classes),

0 commit comments

Comments
 (0)