[GH-ISSUE #631] feature request: expose modal form #461

Closed
opened 2026-03-04 01:05:11 +03:00 by kerem · 2 comments
Owner

Originally created by @SamWhited on GitHub (Aug 3, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/631

Hi, when using modals I frequently want to provide information, eg. a modal with a TextInputView as well as a button for accepting it. Since modals already use a form internally, this requires very few changes (the height must be changed to accommodate the form and the form itself must be exposed in some way, eg. by exporting it or by providing a (m *Modal) Form() *Form) method or similar). Please consider making the form accessible so that other items can be added to it besides buttons. Thanks.

I am happy to submit a PR to implement this change if you are amenable to it.

Originally created by @SamWhited on GitHub (Aug 3, 2021). Original GitHub issue: https://github.com/rivo/tview/issues/631 Hi, when using modals I frequently want to provide information, eg. a modal with a `TextInputView` as well as a button for accepting it. Since modals already use a form internally, this requires very few changes (the height must be changed to accommodate the form and the form itself must be exposed in some way, eg. by exporting it or by providing a `(m *Modal) Form() *Form)` method or similar). Please consider making the form accessible so that other items can be added to it besides buttons. Thanks. I am happy to submit a PR to implement this change if you are amenable to it.
kerem closed this issue 2026-03-04 01:05:12 +03:00
Author
Owner

@rivo commented on GitHub (Sep 27, 2021):

Have you checked out https://github.com/rivo/tview/wiki/Modal already? It's not that difficult to make a Modal with different elements.

I guess the Modal class should have been named Prompt or something. It wasn't only meant for the simple windows that you typically encounter in an application which inform you of something or require some kind of confirmation.

<!-- gh-comment-id:927795839 --> @rivo commented on GitHub (Sep 27, 2021): Have you checked out https://github.com/rivo/tview/wiki/Modal already? It's not that difficult to make a `Modal` with different elements. I guess the `Modal` class should have been named `Prompt` or something. It wasn't only meant for the simple windows that you typically encounter in an application which inform you of something or require some kind of confirmation.
Author
Owner

@SamWhited commented on GitHub (Sep 27, 2021):

That's what I'm doing right now, more or less. I think I ended up using a flex (I had originally copied modal, but decided to reimplement instead), but the modal modifications were simplee and required a lot less work on my end to mimic its behavior. That said, after the form is exposed modals have a lot of duplicate functionality, so maybe it's a bad idea. It remains unclear to me what things count as primitives and should be in the library vs. what I should do myself.

Thanks!

<!-- gh-comment-id:927803778 --> @SamWhited commented on GitHub (Sep 27, 2021): That's what I'm doing right now, more or less. I think I ended up using a flex (I had originally copied modal, but decided to reimplement instead), but the modal modifications were simplee and required a lot less work on my end to mimic its behavior. That said, after the form is exposed modals have a lot of duplicate functionality, so maybe it's a bad idea. It remains unclear to me what things count as primitives and should be in the library vs. what I should do myself. Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#461
No description provided.