Skip to content

Conversation

josca42
Copy link

@josca42 josca42 commented Aug 21, 2025

Quickly creating beautiful UI elements in claude and adding them as custom elements in chainlit enables creating beautiful UX flows that differentiate from the just another chat bot experience. A quick example of this is shown in this video .

Claude natively uses shadcn and recharts so everything almost work out of the box but a few key changes are needed. More tailwind styling needs to be made available to the custom elements.
And since a lot of chainlit users will likely be using it related to analysis workflows - preferring chainlit to streamlit etc. - then the charting functionality used by claude should be available. This means recharts and the shadcn chart component.

This also addresses #2328

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. frontend Pertains to the frontend. labels Aug 21, 2025
@josca42
Copy link
Author

josca42 commented Aug 21, 2025

As promised @asvishnyakov

@josca42
Copy link
Author

josca42 commented Aug 21, 2025

If these changes are something you would like to add then I'd be happy to create some good docs on how to use this kind of workflow to quickly create custom UI elements that you can integrate in your chatbot :-).

@hayescode
Copy link
Contributor

Thanks for this contribution @josca42 this looks very promising! Do you have some examples code to run and see how this works?

Docs/Cookbook will be very helpful for the community once this is released for sure.

Comment on lines +78 to +90
dangerouslySetInnerHTML={{
__html: Object.entries(THEMES)
.map(
([theme, prefix]) => `
${prefix} [data-chart=${id}] {
${colorConfig
.map(([key, itemConfig]) => {
const color =
itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
itemConfig.color;
return color ? ` --color-${key}: ${color};` : null;
})
.join('\n')}
Copy link
Contributor

@sandangel sandangel Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi, why do we need dangerouslySetInnerHTML? can it be set from style attribute instead of dangerouslySetInnerHTML

@sandangel
Copy link
Contributor

some example usage would be great. currently I'm not sure how to use this component.

Copy link

This PR is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Sep 11, 2025
@asvishnyakov asvishnyakov added keep-for-a-while Don’t mark as stale. This label should be used only for confirmed bugs or other important things enhancement New feature or request labels Sep 12, 2025
@sergiossm
Copy link

any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend Pertains to the frontend. keep-for-a-while Don’t mark as stale. This label should be used only for confirmed bugs or other important things size:L This PR changes 100-499 lines, ignoring generated files. stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants