| 1474 | |
| 1475 | |
| 1476 | class PlainTextInputElement(InputInteractiveElement): |
| 1477 | type = "plain_text_input" |
| 1478 | |
| 1479 | @property |
| 1480 | def attributes(self) -> Set[str]: # type: ignore[override] |
| 1481 | return super().attributes.union( |
| 1482 | { |
| 1483 | "initial_value", |
| 1484 | "multiline", |
| 1485 | "min_length", |
| 1486 | "max_length", |
| 1487 | "dispatch_action_config", |
| 1488 | } |
| 1489 | ) |
| 1490 | |
| 1491 | def __init__( |
| 1492 | self, |
| 1493 | *, |
| 1494 | action_id: Optional[str] = None, |
| 1495 | placeholder: Optional[Union[str, dict, TextObject]] = None, |
| 1496 | initial_value: Optional[str] = None, |
| 1497 | multiline: Optional[bool] = None, |
| 1498 | min_length: Optional[int] = None, |
| 1499 | max_length: Optional[int] = None, |
| 1500 | dispatch_action_config: Optional[Union[dict, DispatchActionConfig]] = None, |
| 1501 | focus_on_load: Optional[bool] = None, |
| 1502 | **others: dict, |
| 1503 | ): |
| 1504 | """ |
| 1505 | A plain-text input, similar to the HTML <input> tag, creates a field |
| 1506 | where a user can enter freeform data. It can appear as a single-line |
| 1507 | field or a larger textarea using the multiline flag. Plain-text input |
| 1508 | elements can be used inside of SectionBlocks and ActionsBlocks. |
| 1509 | https://docs.slack.dev/reference/block-kit/block-elements/plain-text-input-element |
| 1510 | |
| 1511 | Args: |
| 1512 | action_id (required): An identifier for the input value when the parent modal is submitted. |
| 1513 | You can use this when you receive a view_submission payload to identify the value of the input element. |
| 1514 | Should be unique among all other action_ids in the containing block. |
| 1515 | Maximum length for this field is 255 characters. |
| 1516 | placeholder: A plain_text only text object that defines the placeholder text shown |
| 1517 | in the plain-text input. Maximum length for the text in this field is 150 characters. |
| 1518 | initial_value: The initial value in the plain-text input when it is loaded. |
| 1519 | multiline: Indicates whether the input will be a single line (false) or a larger textarea (true). |
| 1520 | Defaults to false. |
| 1521 | min_length: The minimum length of input that the user must provide. If the user provides less, |
| 1522 | they will receive an error. Maximum value is 3000. |
| 1523 | max_length: The maximum length of input that the user can provide. If the user provides more, |
| 1524 | they will receive an error. |
| 1525 | dispatch_action_config: A dispatch configuration object that determines when |
| 1526 | during text input the element returns a block_actions payload. |
| 1527 | focus_on_load: Indicates whether the element will be set to auto focus within the view object. |
| 1528 | Only one element can be set to true. Defaults to false. |
| 1529 | """ |
| 1530 | super().__init__( |
| 1531 | type=self.type, |
| 1532 | action_id=action_id, |
| 1533 | placeholder=TextObject.parse(placeholder, PlainTextObject.type), # type: ignore[arg-type] |
no outgoing calls