Skip to content
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

Is there some way to put components in table? #248

Closed
Dragon-GCS opened this issue Mar 15, 2024 · 3 comments
Closed

Is there some way to put components in table? #248

Dragon-GCS opened this issue Mar 15, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Dragon-GCS
Copy link

I'm tring to add some links by markdown on table's row, for operating my data, but seems markdown won't be rendered in table component.

Is there another way to add at least two link to a table cell?

from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from fastui import FastUI, prebuilt_html
from fastui import components as c
from fastui.components.display import DisplayLookup, DisplayMode
from pydantic import BaseModel

app = FastAPI()


class Fake(BaseModel):
    name: str
    action: str


@app.get("/api/", response_model=FastUI, response_model_exclude_none=True)
async def ui():
    fake = [Fake(name="demo", action="[rename](/rename) [remove](/remove)")]
    return [
        c.Page(
            components=[
                c.Table(
                    data=fake,
                    columns=[
                        DisplayLookup(field="name"),
                        DisplayLookup(field="action", mode=DisplayMode.markdown),
                    ],
                ),
            ]
        )
    ]


@app.get("/{path:path}")
def index(path: str) -> HTMLResponse:
    print(path)
    return HTMLResponse(prebuilt_html())

image

@Dragon-GCS Dragon-GCS changed the title Is there some way to put compents in table? Is there some way to put components in table? Mar 15, 2024
@sydney-runkle sydney-runkle added the enhancement New feature or request label May 2, 2024
@sydney-runkle
Copy link
Member

@Dragon-GCS,

Thanks for the feature request. Definitely something we will consider for future releases!

@MMartin09
Copy link

It would also be great to be able to embed a button into the cell.
E.g., you could add an "edit" button to open a form modal.

I think this would be really helpful.

@sydney-runkle
Copy link
Member

Fixed by #279

Also, you might want to check out #308

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants