Skip to content

Add Element component #173

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
Jun 18, 2025
Merged

Add Element component #173

merged 1 commit into from
Jun 18, 2025

Conversation

marklundin
Copy link
Member

This PR adds the Element component for rendering 2D screen space UI elements

import inconsolata from "/fonts/inconsolata.ttf"

export function Text () {

  const { asset: font } = useFont(inconsolata);

  return (
    <Entity>
      <Screen screenSpace/>
      <Entity>
        <Element text="Hey" />
      </Entity>
    </Entity>
  )
}
  • Introduced the Element component to allow entities to render UI elements in screen space.
  • Implemented prop validation and component definition for the Element component.
  • Updated index.ts to export the new Element component alongside existing components.

- Introduced the Element component to allow entities to render UI elements in screen space.
- Implemented prop validation and component definition for the Element component.
- Updated index.ts to export the new Element component alongside existing components.
@marklundin marklundin self-assigned this Jun 17, 2025
@marklundin marklundin added the enhancement New feature or request label Jun 17, 2025
Copy link

pkg-pr-new bot commented Jun 17, 2025

Open in StackBlitz

npm i https://pkg.pr.new/playcanvas/react/@playcanvas/react@173

commit: f08046e

@marklundin marklundin changed the title Add Element component for rendering 2D screen space UI elements Add Element component Jun 17, 2025
@marklundin marklundin merged commit 090ecce into main Jun 18, 2025
5 checks passed
@marklundin marklundin deleted the feat-element-cmponent branch June 18, 2025 15:43
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

Successfully merging this pull request may close these issues.

1 participant