-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I embed a component like an c.Image
in a c.Table
or c.Detail
?
#293
Comments
Hi @sydney-runkle, I don't think this question is a duplicate. The issue is basically that For example, let's say I have an object with a name and an image. from pydantic import BaseCase
import fastui.components as c
class MyType(BaseClass):
name: str
# let's make icon a fastui `Image` component type
icon: c.Image
# create an instance
my_object = MyType(name="meowzer", icon=c.Image(src="image.png"))
# try to render it inside of a `Details` component.
c.Page(
components=[
c.Details(data=my_object)
]
) This will render to something like this:
What I'm expecting is that I get an actual image:
|
Ok great, let's leave this as it's own issue then! I'll mark as an |
@sydney-runkle Yes, it would be a great enhancement. The ability to use a component as a field type of other components will be extremely powerful. Do you know where in the code components are rendered to HTML? Does this happen on the typescript side of things? Looking down into the code it seems like python is generating json which gets passed over to the UI. I could see that getting tricky in terms of doing the recursion there would sort of need to be smart recursion on both sides. |
I have a use case where I'd like to display images inside of table cells. Is there some Image or other base class I can use for my image data and add this as a field of my model (that I pass to c.Table or c.Detail)?
Thanks!
The text was updated successfully, but these errors were encountered: