How do I register a new component, that is only made of components already registered?
I don’t want to use the Canvas to create this complex component, as want it generated via registration code.
Hey Linc! You can specific a code-component as a default value for your slot.
You can get more info here: https://docs.plasmic.app/learn/code-components-ref/#component-instances
Yes, I have been using alot…
defaultValue:
{
type: 'component',
name: getPlasmicComponentName('Container'),
props: {
...
But I simply don’t know how to create the parent component that contains all the component-instances .
For instance. This is a snippet of the original app code and I have all these components registered.
So what would App registration look like?
...
export const App = () => (
<Container maxW="lg" py={{ base: '12', md: '24' }} px={{ base: '0', sm: '8' }}>
<Stack spacing="8">
<Stack spacing="6">
<Logo />
<Stack spacing={{ base: '2', md: '3' }} textAlign="center">
<Heading size={{ base: 'xs', md: 'sm' }}>Log in to your account</Heading>
<HStack spacing="1" justify="center">
<Text color="fg.muted">Don't have an account?</Text>
<Button variant="text" size="lg">
Sign up
</Button>
</HStack>
</Stack>
</Stack>
...
Like, originally I register this ^^^ original component code which I see now was the wrong approach. So would register an empty app?
I am only learning React so I am curious as to what the experts have to say about this, but in this case, isn’t App just another component? It may help if you rename it to something else, like Login. Then you’d register it like you did the other components.
Also, it is my (limited) understanding that you only need to “register” components that you want to use via the interface. If not, they can exist without being registered.
So in your case, if all you need is the Login form as a component to include via the Studio interface, then you’d only have to register App/Login, even though other sub-components are part of it.