Skip to content

[LiveComponent] Add doc about the placeholder macro #1549

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

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

smnandre
Copy link
Member

Add documentation about #1532 (placeholder macro)

@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Feb 26, 2024
To change the initial tag from a ``div`` to something else, use the ``loading-tag`` option:
Both ``loading-template`` and ``loadingContent`` can be used in the template
_calling_ the component. But if want to set this content only once, you can add a
``placeholder`` macro directly in the component template.
Copy link
Member

Choose a reason for hiding this comment

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

macro called placeholder

that makes it more clear that placeholder with name vs placeholder is an adjective

Copy link
Member Author

Choose a reason for hiding this comment

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

"named" placeholder ?


If you style the placeholder content (giving the rows a specific height),
you can then avoid layout shifts when the component is fully loaded (and
the loading content replaced by the real content).
Copy link
Member

Choose a reason for hiding this comment

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

I think it’s a bit too long - the first example is probably enough.

Also, I’m wondering if this should license the FIRST option of customizing loading content. I’d imagine that I would more often embed the loading content inside the template vs in the calling template.

so logic would be:

  • to customize loading, you can add this macro
  • Else, if you want to control loading when calling the component, use the block trick.
  • And, btw, you can control the loading tag for edge cases, like when your element is a tr

Copy link
Member Author

Choose a reason for hiding this comment

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

I've reordered all .. tell me if better

@weaverryan weaverryan force-pushed the doc/live-placeholder-macro branch from 349505a to a7c2cb3 Compare February 27, 2024 11:24
@weaverryan
Copy link
Member

Very nice - thank you Simon!

@weaverryan weaverryan merged commit 221e22e into symfony:2.x Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Review Needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants