I am trying stand up a a Kratos instance for a Tan...
# ory-selfhosting
d
I am trying stand up a a Kratos instance for a TanStack Start app that I am playing with. I am struggling with the mental model for how to work with Kratos forms. The forms are fetched and rendered from the server so I am losing type safety but the form definition is also incomplete so I have to define things like placeholder in client so why not just statically define the form. Am I missing something?
m
Hey @damp-television-87203 Ory Kratos uses a "headless" approach for UI rendering. Instead of providing pre-built UI components, Kratos sends you a JSON structure that describes the form elements that need to be rendered. This approach gives you flexibility in how you implement the UI. The reason for this design is to make the UI adaptive to changes in your Kratos configuration without requiring code changes. You can see an example implementation here https://github.com/ory/kratos-selfservice-ui-node or here https://github.com/ory/awesome-ory you can also use https://github.com/ory/elements/ that might make it easier. If you haven't seen it these docs might help: https://www.ory.sh/docs/kratos/self-service/flows/user-login https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration
d
I may not be articulating correctly, but it feels like the intent of the ui.nodes is to be a form DSL of sorts. But the DSL is incomplete. If I need something like a placeholder for my email field, I have to very specifically have a switch to map the field into an email field but hardcode my placeholder. Which kind of leaves me in between a dynamic and a static form.
m
I see 🤔 I guess you are not using Ory Elements? You could open a discussion in the appropriate repo on GitHub and we can go a bit more into detail there, with code examples etc. and maybe figure out what an preferred/ideal solution would be
d
Nah - I didn't reach for the elements. I was just rendering on top of pretty much vanilla shadcn components. Happy to write something up in GitHub if you think it's useful.