assignment_late
Why donate
travel_explore
API Explorer
widgets
Vue Components
Ajax Bar
Avatar
Badge
Banner
Bar
Breadcrumbs
Card
Carousel
Chat Message
Chip
Circular Progress
Color Picker
Dialog
Editor - WYSIWYG
Expansion Item
Floating Action Button
Icon
Img
Infinite Scroll
Inner Loading
Intersection
Knob
Linear Progress
List & List Items
Markup Table
Menu
No SSR
Pagination
Parallax
Popup Edit
Popup Proxy
Pull to refresh
Rating
Responsive
Scroll Area
Separator
Skeleton
Slide Item
Slide Transition
Space
Spinners
Splitter
Stepper
Table
Tabs
Tab Panels
Timeline
Toolbar
Tooltip
Tree
Uploader
Video
Virtual Scroll
security
Security
build
Quasar CLI (with Vite)
Upgrade guide
NEW!
The quasar.config file
Convert project to CLI with Vite
Browser Compatibility
Supporting TypeScript
Directory Structure
Commands List
CSS Preprocessors
Routing
Lazy Loading - Code Splitting
Handling Assets
Boot Files
Prefetch Feature
API Proxying
Handling Vite
Handling process.env
State Management with Pinia
Linter
Testing & Auditing
Developing Mobile Apps
Ajax Requests
Opening Dev Server To Public
build
Quasar CLI (with Webpack)
Upgrade guide
NEW!
The quasar.config file
Convert to CLI with Webpack
Browser Compatibility
Supporting TypeScript
Directory Structure
Commands List
CSS Preprocessors
Routing
Lazy Loading - Code Splitting
Handling Assets
Boot Files
Prefetch Feature
API Proxying
Handling Webpack
Handling process.env
State Management with Pinia
Linter
Testing & Auditing
Developing Mobile Apps
Ajax Requests
Opening Dev Server To Public
note_add
App Extensions
The useId()
composable returns a Vue Ref holding a string that can be used as a unique identifier to apply to a DOM node attribute.
Should you supply a function (getValue
from the typing below) to get the value that the id might have, it will make sure to keep it updated.
On SSR, it takes into account the process of hydration so that your component won’t generate any such errors.
Syntax
import { useId } from 'quasar'
setup () {
const id = useId()
// ...
}
content_paste
Copied to clipboard
function useId(
opts?: {
getValue?: () => string | null | undefined;
required?: boolean; // default: true
}
): Ref<string | null>;
content_paste
Copied to clipboard
Example
<template>
<div :id="id">
Some component
</div>
</template>
<script>
import { useId } from 'quasar'
export default {
props: {
for: String
},
setup () {
const id = useId({
getValue: () => props.for,
required: true
})
return { id }
}
}
</script>
content_paste
Copied to clipboard
Ready for more?
Caught a mistake?Edit this page in browser
1. Introduction
2. Syntax
3. Example
Copyright © 2015-present PULSARDEV SRL, Razvan Stoenescu
This website has been designed in collaboration with Dreamonkey Srl