You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to create an array of different bubbles UI components. The issue I've come across is that there is no great way to create an interface to group all of the components because each component exists as a separate package with each Model struct registered as separate type.
I was wondering why Init function isn't implemented for each component as such:
func (mModel) Init() tea.Cmd {
returnnil
}
And change the output type for the Update function:
After trying out an example, the implementation of the ui Model as tea.Model complicates the situation more as many of functions of ui components aren't implemented through tea.Model.
However, I'm wondering if creating a overarching interface for all the ui components could be helpful in the case of multi-component ui creation.
On that note, changing the title & keeping this thread open.
sanghunjlee
changed the title
Feature request: Implement Init function
Feature request: Creating overarching interface for all ui component models
Apr 23, 2023
I ran into this, too... I'm curious, why don't Bubbles implement tea.Model?
In my case, I'm working on an app that asks different kinds of questions, and uses different components depending on the kind of question. So far it's been nice to generalize the interchangeable components with the type tea.Model, since it provides more type guarantee than just interface{}.
I have some of my own components, but I went to reach for textinput.Model because it handles text input so well. But then I got an error that it doesn't implement tea.Model, and I thought "this can't be right...". It looks like if only it implemented Init() and returned a nil command, this would work?
I want to create an array of different bubbles UI components. The issue I've come across is that there is no great way to create an interface to group all of the components because each component exists as a separate package with each Model struct registered as separate type.
I was wondering why Init function isn't implemented for each component as such:
And change the output type for the Update function:
The text was updated successfully, but these errors were encountered: