Appearance
Overlay
Overlay is a layer obscuring the page in such a way that, together with additional modal components or lateral navigation, create specific functionalities in which we define in which area the user can perform.
Props
canClose
Specifies if overlay can be closed (by default: yes)
type:
Boolean
default:
true
absolute
Specifies whether overlay should have a fixed position (default) or absolute.
type:
Boolean
default:
false
Events
hideOverlay
Should cause setting the layer visibility to false
Examples
html
<a @click="displaySample()" href="#">Open overlay</a> <overlay />
1
ts
import { useOverlayStore } from '@riupress/ui'
const useOverlay = useOverlayStore()
function displaySample() {
useOverlay.updateShow(true)
}
function close() {
useOverlay.updateShowTemplate(false)
useOverlay.updateShow(true)
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
WARNING
Overlay has a Tailwind class set on z-20
determining z-index. This value should be remembered when building components to cooperate with overlay.
State for Overlay
Ordering the condition of the layer, i.e. mainly including visibility and the relationship into other elements is solved using the Pinia Store.
ts
import { defineStore } from 'pinia'
export const useOverlayStore = defineStore('overlay', {
state: () => ({
overlay: false,
template: false,
name: 'default'
}),
getters: {
getOverlay(state) {
return state.overlay
},
getTemplate(state) {
return state.template
},
getName(state) {
return state.name
}
},
actions: {
show(val: string) {
this.name = val
this.template = true
this.overlay = true
},
setOverlay(val: boolean) {
this.overlay = val
},
setTemplate(val: boolean) {
this.template = val
},
setName(val: string) {
this.name = val
},
close() {
this.overlay = false
this.template = false
}
}
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40