2.0 alpha
These docs describe 2.0. Install it with @once-ui-system/core@alpha.
On 1.8.x? Read the 1.x docs
TrademarkTrademarkDocs
Ctrl k
Search docs...
Components

ElementType

Updated: June 30, 2026
View on GitHub
The ElementType component is a utility component that dynamically renders as different HTML elements based on the props provided. It can render as a link (<a> or Next.js <Link>), a button, or a div, making it useful for creating interactive elements with consistent styling but different underlying behaviors. ElementType automatically handles both internal and external links. ElementType renders as a button when provided with an onClick handler or type prop. When no interactive props are provided, ElementType renders as a Flex component. The ElementType component follows these rules to determine which element to render:
  • If href is provided and the URL is external (starts with http:// or https://), renders as an <a> tag with target="_blank" and rel="noreferrer". If the URL is internal, renders as a Next.js <Link> component
  • If onClick is provided or type is "submit" or "button", renders as a <button> element
  • Otherwise, renders as a <Flex> component (which is a div with additional styling)
The ElementType component is designed to be used internally by other Once UI components to provide consistent behavior while allowing flexibility in the rendered HTML element. For example, it's used by the Button component to enable both link and button behaviors.
Prop
Type
Default
href
string
onClick
() => void
onLinkClick
() => void
type
buttonsubmitreset
children
React.ReactNode
className
string
style
React.CSSProperties
…and every FlexProps propinherited
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club