@rio-cloud/uikit-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +91 -0
- package/bin/uikit-mcp.mjs +23 -0
- package/data/pages/Components/components/accentbar.json +207 -0
- package/data/pages/Components/components/activity.json +87 -0
- package/data/pages/Components/components/animatednumber.json +99 -0
- package/data/pages/Components/components/animations.json +87 -0
- package/data/pages/Components/components/appheader.json +291 -0
- package/data/pages/Components/components/applayout.json +1198 -0
- package/data/pages/Components/components/appnavigationbar.json +327 -0
- package/data/pages/Components/components/areacharts.json +563 -0
- package/data/pages/Components/components/aspectratioplaceholder.json +75 -0
- package/data/pages/Components/components/assettree.json +3080 -0
- package/data/pages/Components/components/autosuggests.json +710 -0
- package/data/pages/Components/components/avatar.json +157 -0
- package/data/pages/Components/components/banner.json +599 -0
- package/data/pages/Components/components/barcharts.json +1507 -0
- package/data/pages/Components/components/barlist.json +223 -0
- package/data/pages/Components/components/basicmap.json +68 -0
- package/data/pages/Components/components/bottomsheet.json +601 -0
- package/data/pages/Components/components/button.json +583 -0
- package/data/pages/Components/components/buttontoolbar.json +63 -0
- package/data/pages/Components/components/calendarstripe.json +235 -0
- package/data/pages/Components/components/card.json +69 -0
- package/data/pages/Components/components/carousel.json +39 -0
- package/data/pages/Components/components/chartcolors.json +34 -0
- package/data/pages/Components/components/chartsgettingstarted.json +32 -0
- package/data/pages/Components/components/chat.json +39 -0
- package/data/pages/Components/components/checkbox.json +847 -0
- package/data/pages/Components/components/clearableinput.json +789 -0
- package/data/pages/Components/components/collapse.json +175 -0
- package/data/pages/Components/components/composedcharts.json +159 -0
- package/data/pages/Components/components/contentloader.json +233 -0
- package/data/pages/Components/components/datatabs.json +680 -0
- package/data/pages/Components/components/datepickers.json +287 -0
- package/data/pages/Components/components/dialogs.json +1492 -0
- package/data/pages/Components/components/divider.json +93 -0
- package/data/pages/Components/components/dropdowns.json +936 -0
- package/data/pages/Components/components/editablecontent.json +1117 -0
- package/data/pages/Components/components/expander.json +377 -0
- package/data/pages/Components/components/fade.json +403 -0
- package/data/pages/Components/components/fadeexpander.json +75 -0
- package/data/pages/Components/components/fadeup.json +127 -0
- package/data/pages/Components/components/feedback.json +269 -0
- package/data/pages/Components/components/filepickers.json +269 -0
- package/data/pages/Components/components/formlabel.json +115 -0
- package/data/pages/Components/components/fullscreenmap.json +22 -0
- package/data/pages/Components/components/groupeditemlist.json +323 -0
- package/data/pages/Components/components/iconlist.json +45 -0
- package/data/pages/Components/components/imagepreloader.json +81 -0
- package/data/pages/Components/components/labeledelement.json +75 -0
- package/data/pages/Components/components/licenseplate.json +69 -0
- package/data/pages/Components/components/linecharts.json +987 -0
- package/data/pages/Components/components/listmenu.json +313 -0
- package/data/pages/Components/components/loadmore.json +175 -0
- package/data/pages/Components/components/mainnavigation.json +39 -0
- package/data/pages/Components/components/mapcircle.json +34 -0
- package/data/pages/Components/components/mapcluster.json +51 -0
- package/data/pages/Components/components/mapcontext.json +105 -0
- package/data/pages/Components/components/mapdraggablemarker.json +34 -0
- package/data/pages/Components/components/mapgettingstarted.json +27 -0
- package/data/pages/Components/components/mapgroup.json +1198 -0
- package/data/pages/Components/components/mapinfobubble.json +34 -0
- package/data/pages/Components/components/maplayergroup.json +34 -0
- package/data/pages/Components/components/mapmarker.json +700 -0
- package/data/pages/Components/components/mappolygon.json +45 -0
- package/data/pages/Components/components/maproute.json +623 -0
- package/data/pages/Components/components/maproutegenerator.json +16 -0
- package/data/pages/Components/components/mapsettings.json +51 -0
- package/data/pages/Components/components/maputils.json +34 -0
- package/data/pages/Components/components/multiselects.json +1451 -0
- package/data/pages/Components/components/nodata.json +139 -0
- package/data/pages/Components/components/notifications.json +65 -0
- package/data/pages/Components/components/numbercontrol.json +301 -0
- package/data/pages/Components/components/onboarding.json +302 -0
- package/data/pages/Components/components/page.json +197 -0
- package/data/pages/Components/components/pager.json +93 -0
- package/data/pages/Components/components/piecharts.json +731 -0
- package/data/pages/Components/components/popover.json +251 -0
- package/data/pages/Components/components/position.json +69 -0
- package/data/pages/Components/components/radialbarcharts.json +1304 -0
- package/data/pages/Components/components/radiobutton.json +1105 -0
- package/data/pages/Components/components/releasenotes.json +44 -0
- package/data/pages/Components/components/resizer.json +93 -0
- package/data/pages/Components/components/responsivecolumnstripe.json +123 -0
- package/data/pages/Components/components/responsivevideo.json +75 -0
- package/data/pages/Components/components/rioglyph.json +93 -0
- package/data/pages/Components/components/rules.json +410 -0
- package/data/pages/Components/components/saveableinput.json +703 -0
- package/data/pages/Components/components/selects.json +701 -0
- package/data/pages/Components/components/sidebar.json +243 -0
- package/data/pages/Components/components/sliders.json +235 -0
- package/data/pages/Components/components/smoothscrollbars.json +335 -0
- package/data/pages/Components/components/spinners.json +343 -0
- package/data/pages/Components/components/states.json +1705 -0
- package/data/pages/Components/components/statswidgets.json +314 -0
- package/data/pages/Components/components/statusbar.json +177 -0
- package/data/pages/Components/components/stepbutton.json +57 -0
- package/data/pages/Components/components/steppedprogressbars.json +417 -0
- package/data/pages/Components/components/subnavigation.json +107 -0
- package/data/pages/Components/components/supportmarker.json +45 -0
- package/data/pages/Components/components/svgimage.json +81 -0
- package/data/pages/Components/components/switch.json +111 -0
- package/data/pages/Components/components/tables.json +144 -0
- package/data/pages/Components/components/tagmanager.json +86 -0
- package/data/pages/Components/components/tags.json +146 -0
- package/data/pages/Components/components/teaser.json +188 -0
- package/data/pages/Components/components/timeline.json +45 -0
- package/data/pages/Components/components/timepicker.json +163 -0
- package/data/pages/Components/components/togglebutton.json +247 -0
- package/data/pages/Components/components/tooltip.json +270 -0
- package/data/pages/Components/components/virtuallist.json +175 -0
- package/data/pages/Foundations/foundations.json +2475 -0
- package/data/pages/Getting-started/start/changelog.json +22 -0
- package/data/pages/Getting-started/start/goodtoknow.json +32 -0
- package/data/pages/Getting-started/start/guidelines/color-combinations.json +58 -0
- package/data/pages/Getting-started/start/guidelines/custom-css.json +27 -0
- package/data/pages/Getting-started/start/guidelines/custom-rioglyph.json +22 -0
- package/data/pages/Getting-started/start/guidelines/formatting.json +97 -0
- package/data/pages/Getting-started/start/guidelines/iframe.json +93 -0
- package/data/pages/Getting-started/start/guidelines/obfuscate-data.json +22 -0
- package/data/pages/Getting-started/start/guidelines/print-css.json +37 -0
- package/data/pages/Getting-started/start/guidelines/spinner.json +144 -0
- package/data/pages/Getting-started/start/guidelines/supported-browsers.json +22 -0
- package/data/pages/Getting-started/start/guidelines/writing.json +242 -0
- package/data/pages/Getting-started/start/howto.json +72 -0
- package/data/pages/Getting-started/start/intro.json +37 -0
- package/data/pages/Getting-started/start/responsiveness.json +52 -0
- package/data/pages/Templates/templates/common-table.json +39 -0
- package/data/pages/Templates/templates/detail-views.json +71 -0
- package/data/pages/Templates/templates/expandable-details.json +39 -0
- package/data/pages/Templates/templates/feature-cards.json +103 -0
- package/data/pages/Templates/templates/form-summary.json +39 -0
- package/data/pages/Templates/templates/form-toggle.json +39 -0
- package/data/pages/Templates/templates/list-blocks.json +119 -0
- package/data/pages/Templates/templates/loading-progress.json +39 -0
- package/data/pages/Templates/templates/options-panel.json +39 -0
- package/data/pages/Templates/templates/panel-variants.json +39 -0
- package/data/pages/Templates/templates/progress-cards.json +71 -0
- package/data/pages/Templates/templates/progress-success.json +39 -0
- package/data/pages/Templates/templates/settings-form.json +39 -0
- package/data/pages/Templates/templates/stats-blocks.json +135 -0
- package/data/pages/Templates/templates/table-panel.json +39 -0
- package/data/pages/Templates/templates/table-row-animation.json +39 -0
- package/data/pages/Templates/templates/usage-cards.json +39 -0
- package/data/pages/Utilities/utilities/deviceutils.json +39 -0
- package/data/pages/Utilities/utilities/featuretoggles.json +42 -0
- package/data/pages/Utilities/utilities/fueltypeutils.json +118 -0
- package/data/pages/Utilities/utilities/routeutils.json +34 -0
- package/data/pages/Utilities/utilities/useaftermount.json +63 -0
- package/data/pages/Utilities/utilities/useaverage.json +86 -0
- package/data/pages/Utilities/utilities/useclickoutside.json +69 -0
- package/data/pages/Utilities/utilities/useclipboard.json +57 -0
- package/data/pages/Utilities/utilities/usecount.json +92 -0
- package/data/pages/Utilities/utilities/usedarkmode.json +50 -0
- package/data/pages/Utilities/utilities/usedebuginfo.json +63 -0
- package/data/pages/Utilities/utilities/useeffectonce.json +57 -0
- package/data/pages/Utilities/utilities/useelapsedtime.json +57 -0
- package/data/pages/Utilities/utilities/useelementsize.json +63 -0
- package/data/pages/Utilities/utilities/useesc.json +57 -0
- package/data/pages/Utilities/utilities/useevent.json +75 -0
- package/data/pages/Utilities/utilities/usefocustrap.json +57 -0
- package/data/pages/Utilities/utilities/usefullscreen.json +197 -0
- package/data/pages/Utilities/utilities/usehover.json +57 -0
- package/data/pages/Utilities/utilities/useinterval.json +63 -0
- package/data/pages/Utilities/utilities/useisfocuswithin.json +75 -0
- package/data/pages/Utilities/utilities/usekey.json +75 -0
- package/data/pages/Utilities/utilities/uselocalstorage.json +69 -0
- package/data/pages/Utilities/utilities/uselocationsuggestions.json +110 -0
- package/data/pages/Utilities/utilities/usemax.json +86 -0
- package/data/pages/Utilities/utilities/usemin.json +86 -0
- package/data/pages/Utilities/utilities/usemutationobserver.json +69 -0
- package/data/pages/Utilities/utilities/useonlinestatus.json +39 -0
- package/data/pages/Utilities/utilities/useonscreen.json +63 -0
- package/data/pages/Utilities/utilities/usepostmessage.json +80 -0
- package/data/pages/Utilities/utilities/useprevious.json +63 -0
- package/data/pages/Utilities/utilities/useresizeobserver.json +65 -0
- package/data/pages/Utilities/utilities/usescrollposition.json +103 -0
- package/data/pages/Utilities/utilities/usesearch.json +197 -0
- package/data/pages/Utilities/utilities/usesorting.json +139 -0
- package/data/pages/Utilities/utilities/usestatewithvalidation.json +69 -0
- package/data/pages/Utilities/utilities/usesum.json +86 -0
- package/data/pages/Utilities/utilities/usetableexport.json +87 -0
- package/data/pages/Utilities/utilities/usetableselection.json +311 -0
- package/data/pages/Utilities/utilities/usetimeout.json +63 -0
- package/data/pages/Utilities/utilities/usetoggle.json +75 -0
- package/data/pages/Utilities/utilities/usewindowresize.json +63 -0
- package/data/version.json +4 -0
- package/docs/content-schema.md +147 -0
- package/docs/navigation-inventory.json +1310 -0
- package/docs/search-synonyms.json +43 -0
- package/package.json +38 -0
- package/server/index.mjs +268 -0
- package/server/lib/load-docs.mjs +48 -0
- package/server/lib/normalise-doc.mjs +220 -0
- package/server/lib/render-markdown.mjs +82 -0
- package/server/lib/search-index.mjs +49 -0
- package/server/lib/types.js +99 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"captured_at": "2025-11-21T12:08:39.887Z",
|
|
4
|
+
"source": "https://uikit.developers.rio.cloud/#utilities/useFullscreen",
|
|
5
|
+
"category": "Utilities",
|
|
6
|
+
"section": "DOM behavior hooks",
|
|
7
|
+
"slug": "utilities/usefullscreen",
|
|
8
|
+
"version": "v1.13.2",
|
|
9
|
+
"hash_algorithm": "sha256",
|
|
10
|
+
"hash": "64783ec47b39927460a660a5afe85f7ed26a9219aeb6c884ff435f13c83c3055"
|
|
11
|
+
},
|
|
12
|
+
"title": "useFullscreen",
|
|
13
|
+
"lead": "The cross-browser useFullscreen hook allows to easily switch to fullscreen mode for the document or a dedicated element like a map or a certain part of a service.",
|
|
14
|
+
"content": [
|
|
15
|
+
{
|
|
16
|
+
"heading": "useFullscreen",
|
|
17
|
+
"body": "Fullscreen on dedicated element",
|
|
18
|
+
"examples": [
|
|
19
|
+
{
|
|
20
|
+
"caption": "Example 1",
|
|
21
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><div>Fullscreen enabled: <span>false</span></div><hr><div>Is Fullscreen active: <span>false</span></div><hr><div class=\"btn-toolbar\"><div class=\"btn btn-default\">Request Fullscreen</div><div class=\"btn btn-default\">Exit Fullscreen</div><div class=\"btn btn-default\">Toggle Fullscreen</div></div></div></div>",
|
|
22
|
+
"tabs": [
|
|
23
|
+
{
|
|
24
|
+
"label": "React",
|
|
25
|
+
"language": "tsx",
|
|
26
|
+
"code": "import useFullscreen from '@rio-cloud/rio-uikit/useFullscreen';\n\nexport default () => {\n const handleChange = (event: Event) => console.log(event);\n const handleError = (event: Event) => console.log(event);\n\n const { exitFullscreen, isEnabled, isFullscreen, requestFullscreen, toggleFullscreen } = useFullscreen({\n onChange: handleChange,\n onError: handleError,\n });\n\n return (\n <div>\n <div>\n Fullscreen enabled: <span>{`${isEnabled}`}</span>\n </div>\n <hr />\n <div>\n Is Fullscreen active: <span>{`${isFullscreen}`}</span>\n </div>\n <hr />\n <div className='btn-toolbar'>\n <div className='btn btn-default' onClick={requestFullscreen}>\n Request Fullscreen\n </div>\n <div className='btn btn-default' onClick={exitFullscreen}>\n Exit Fullscreen\n </div>\n <div className='btn btn-default' onClick={toggleFullscreen}>\n Toggle Fullscreen\n </div>\n </div>\n </div>\n );\n};"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "HTML",
|
|
30
|
+
"language": "html",
|
|
31
|
+
"code": "<div>\n <div>Fullscreen enabled: <span>false</span>\n </div>\n <hr>\n <div>Is Fullscreen active: <span>false</span>\n </div>\n <hr>\n <div class=\"btn-toolbar\">\n <div class=\"btn btn-default\">Request Fullscreen</div>\n <div class=\"btn btn-default\">Exit Fullscreen</div>\n <div class=\"btn btn-default\">Toggle Fullscreen</div>\n </div>\n</div>"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"label": "Props",
|
|
35
|
+
"language": "json",
|
|
36
|
+
"code": null,
|
|
37
|
+
"props": [
|
|
38
|
+
{
|
|
39
|
+
"heading": null,
|
|
40
|
+
"rows": [
|
|
41
|
+
{
|
|
42
|
+
"name": "element",
|
|
43
|
+
"type": "HTMLElement",
|
|
44
|
+
"default": "",
|
|
45
|
+
"description": "The target element other than document. Note, the element need to be existing in the DOM when initializing the hook. Otherwise pass the element as argument to the \"requestFullscreen\" function."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "onChange",
|
|
49
|
+
"type": "(callback: OnChangeEventCallback) => void",
|
|
50
|
+
"default": "() => {}",
|
|
51
|
+
"description": "Custom callback function for acting on the fullscreen change."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "onError",
|
|
55
|
+
"type": "(callback: EventCallback) => void",
|
|
56
|
+
"default": "() => {}",
|
|
57
|
+
"description": "Custom callback function for acting on an error when the fullscreen fails."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "requestFullscreenOptions",
|
|
61
|
+
"type": "{ navigationUI?: string | \"auto\" | \"hide\" | \"show\" }",
|
|
62
|
+
"default": "{}",
|
|
63
|
+
"description": "Define additional options for requesting the fullscreen."
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"heading": null,
|
|
69
|
+
"rows": [
|
|
70
|
+
{
|
|
71
|
+
"name": "requestFullscreen",
|
|
72
|
+
"type": "(targetElement: HTMLElement) => void",
|
|
73
|
+
"default": "",
|
|
74
|
+
"description": "This function requests the fullscreen to the browser. It takes an optional argument to define the target element later than on init."
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "exitFullscreen",
|
|
78
|
+
"type": "Function",
|
|
79
|
+
"default": "",
|
|
80
|
+
"description": "This function exits the fullscreen."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "toggleFullscreen",
|
|
84
|
+
"type": "Function",
|
|
85
|
+
"default": "",
|
|
86
|
+
"description": "This function requests or exists the fullscreen depending on the fullscreen state."
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "isFullscreen",
|
|
90
|
+
"type": "Boolean",
|
|
91
|
+
"default": "",
|
|
92
|
+
"description": "Defines whether the browser is in fullscreen mode. Note, the can only be on element in fullscreen at a time, either the document or a dedicated element."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "isEnabled",
|
|
96
|
+
"type": "Boolean",
|
|
97
|
+
"default": "",
|
|
98
|
+
"description": "Tells you if the browser allows the fullscreen mode."
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"caption": "Example 2",
|
|
108
|
+
"rendered_html": "<div class=\"playground-content bg-lighter padding-20 padding-bottom-25\" style=\"width: 100%;\"><div class=\"example-wrapper bg-lighter display-grid\"><div class=\"panel panel-default shadow-default \"><div class=\"panel-heading display-flex justify-content-between align-items-center\"><div class=\"text-medium text-color-darker\">Example - click on expand icon to use fullscreen</div><div class=\"text-color-gray text-size-16 cursor-pointer\"><span class=\"rioglyph rioglyph-fullscreen\"></span></div></div><div class=\"panel-body\"><p>Sample content. <br>Here you can have arbitrary content like a map or charts etc.</p></div></div></div></div>",
|
|
109
|
+
"tabs": [
|
|
110
|
+
{
|
|
111
|
+
"label": "React",
|
|
112
|
+
"language": "tsx",
|
|
113
|
+
"code": "import { useRef } from 'react';\n\nimport useFullscreen from '@rio-cloud/rio-uikit/useFullscreen';\n\nimport { dummyTextLong } from '../../../utils/data';\n\nexport default () => {\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const { toggleFullscreen, isFullscreen } = useFullscreen();\n\n return (\n <div className='example-wrapper bg-lighter display-grid' ref={wrapperRef}>\n <div className={`panel panel-default shadow-default ${isFullscreen ? 'margin-25' : ''}`}>\n <div className='panel-heading display-flex justify-content-between align-items-center'>\n <div className='text-medium text-color-darker'>\n Example - click on expand icon to use fullscreen\n </div>\n <div\n className='text-color-gray text-size-16 cursor-pointer'\n onClick={() => toggleFullscreen(wrapperRef.current)}\n >\n <span className='rioglyph rioglyph-fullscreen' />\n </div>\n </div>\n <div className='panel-body'>\n <p>\n Sample content. <br />\n Here you can have arbitrary content like a map or charts etc.\n </p>\n {isFullscreen && <p>{dummyTextLong}</p>}\n </div>\n </div>\n </div>\n );\n};"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"label": "HTML",
|
|
117
|
+
"language": "html",
|
|
118
|
+
"code": "<div class=\"example-wrapper bg-lighter display-grid\">\n <div class=\"panel panel-default shadow-default \">\n <div class=\"panel-heading display-flex justify-content-between align-items-center\">\n <div class=\"text-medium text-color-darker\">Example - click on expand icon to use fullscreen</div>\n <div class=\"text-color-gray text-size-16 cursor-pointer\">\n <span class=\"rioglyph rioglyph-fullscreen\">\n </span>\n </div>\n </div>\n <div class=\"panel-body\">\n <p>Sample content. <br>Here you can have arbitrary content like a map or charts etc.</p>\n </div>\n </div>\n</div>"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"label": "Props",
|
|
122
|
+
"language": "json",
|
|
123
|
+
"code": null,
|
|
124
|
+
"props": [
|
|
125
|
+
{
|
|
126
|
+
"heading": null,
|
|
127
|
+
"rows": [
|
|
128
|
+
{
|
|
129
|
+
"name": "element",
|
|
130
|
+
"type": "HTMLElement",
|
|
131
|
+
"default": "",
|
|
132
|
+
"description": "The target element other than document. Note, the element need to be existing in the DOM when initializing the hook. Otherwise pass the element as argument to the \"requestFullscreen\" function."
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "onChange",
|
|
136
|
+
"type": "(callback: OnChangeEventCallback) => void",
|
|
137
|
+
"default": "() => {}",
|
|
138
|
+
"description": "Custom callback function for acting on the fullscreen change."
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "onError",
|
|
142
|
+
"type": "(callback: EventCallback) => void",
|
|
143
|
+
"default": "() => {}",
|
|
144
|
+
"description": "Custom callback function for acting on an error when the fullscreen fails."
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "requestFullscreenOptions",
|
|
148
|
+
"type": "{ navigationUI?: string | \"auto\" | \"hide\" | \"show\" }",
|
|
149
|
+
"default": "{}",
|
|
150
|
+
"description": "Define additional options for requesting the fullscreen."
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"heading": null,
|
|
156
|
+
"rows": [
|
|
157
|
+
{
|
|
158
|
+
"name": "requestFullscreen",
|
|
159
|
+
"type": "(targetElement: HTMLElement) => void",
|
|
160
|
+
"default": "",
|
|
161
|
+
"description": "This function requests the fullscreen to the browser. It takes an optional argument to define the target element later than on init."
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"name": "exitFullscreen",
|
|
165
|
+
"type": "Function",
|
|
166
|
+
"default": "",
|
|
167
|
+
"description": "This function exits the fullscreen."
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "toggleFullscreen",
|
|
171
|
+
"type": "Function",
|
|
172
|
+
"default": "",
|
|
173
|
+
"description": "This function requests or exists the fullscreen depending on the fullscreen state."
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"name": "isFullscreen",
|
|
177
|
+
"type": "Boolean",
|
|
178
|
+
"default": "",
|
|
179
|
+
"description": "Defines whether the browser is in fullscreen mode. Note, the can only be on element in fullscreen at a time, either the document or a dedicated element."
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "isEnabled",
|
|
183
|
+
"type": "Boolean",
|
|
184
|
+
"default": "",
|
|
185
|
+
"description": "Tells you if the browser allows the fullscreen mode."
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"see_also": []
|
|
197
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"captured_at": "2025-11-21T12:08:40.037Z",
|
|
4
|
+
"source": "https://uikit.developers.rio.cloud/#utilities/useHover",
|
|
5
|
+
"category": "Utilities",
|
|
6
|
+
"section": "DOM behavior hooks",
|
|
7
|
+
"slug": "utilities/usehover",
|
|
8
|
+
"version": "v1.13.2",
|
|
9
|
+
"hash_algorithm": "sha256",
|
|
10
|
+
"hash": "9d375b6fdd4c772a8567db29c8f715734c239b88e9170b7ffc78158830755546"
|
|
11
|
+
},
|
|
12
|
+
"title": "useHover",
|
|
13
|
+
"lead": null,
|
|
14
|
+
"content": [
|
|
15
|
+
{
|
|
16
|
+
"heading": "useHover",
|
|
17
|
+
"body": "",
|
|
18
|
+
"examples": [
|
|
19
|
+
{
|
|
20
|
+
"caption": "Example 1",
|
|
21
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div class=\"well display-flex gap-10 align-items-center border hover-border-color-primary max-width-300 cursor-pointer\"><span class=\"text-color-darker text-size-16 text-medium\">Lorem ipsum dolor sit amet</span></div></div>",
|
|
22
|
+
"tabs": [
|
|
23
|
+
{
|
|
24
|
+
"label": "React",
|
|
25
|
+
"language": "tsx",
|
|
26
|
+
"code": "/* eslint-disable max-len */\nimport { useRef } from 'react';\n\nimport useHover from '@rio-cloud/rio-uikit/useHover';\n\nexport default () => {\n const ref = useRef<HTMLInputElement>(null);\n\n const isHover = useHover(ref);\n\n return (\n <div\n ref={ref}\n className='well display-flex gap-10 align-items-center border hover-border-color-primary max-width-300 cursor-pointer'\n >\n <span className='text-color-darker text-size-16 text-medium'>Lorem ipsum dolor sit amet</span>\n {isHover && <span className='rioglyph rioglyph-antenna text-size-20 text-color-primary' />}\n </div>\n );\n};"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "HTML",
|
|
30
|
+
"language": "html",
|
|
31
|
+
"code": "<div class=\"well display-flex gap-10 align-items-center border hover-border-color-primary max-width-300 cursor-pointer\">\n <span class=\"text-color-darker text-size-16 text-medium\">Lorem ipsum dolor sit amet</span>\n</div>"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"label": "Props",
|
|
35
|
+
"language": "json",
|
|
36
|
+
"code": null,
|
|
37
|
+
"props": [
|
|
38
|
+
{
|
|
39
|
+
"heading": null,
|
|
40
|
+
"rows": [
|
|
41
|
+
{
|
|
42
|
+
"name": "ref",
|
|
43
|
+
"type": "React.Ref",
|
|
44
|
+
"default": "",
|
|
45
|
+
"description": "The reference to the element that shall be hovered."
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"see_also": []
|
|
57
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"captured_at": "2025-11-21T12:08:36.368Z",
|
|
4
|
+
"source": "https://uikit.developers.rio.cloud/#utilities/useInterval",
|
|
5
|
+
"category": "Utilities",
|
|
6
|
+
"section": "Lifecycle & execution hooks",
|
|
7
|
+
"slug": "utilities/useinterval",
|
|
8
|
+
"version": "v1.13.2",
|
|
9
|
+
"hash_algorithm": "sha256",
|
|
10
|
+
"hash": "79bcf41fedf57d336eef48b7e79da24ae687c47633ac56e152281257acca9c73"
|
|
11
|
+
},
|
|
12
|
+
"title": "useInterval",
|
|
13
|
+
"lead": "The useInterval hook allows for executing some code after a specified amount of time.",
|
|
14
|
+
"content": [
|
|
15
|
+
{
|
|
16
|
+
"heading": "useInterval",
|
|
17
|
+
"body": "",
|
|
18
|
+
"examples": [
|
|
19
|
+
{
|
|
20
|
+
"caption": "Example 1",
|
|
21
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div class=\"display-flex flex-column justify-content-center align-items-center\"><div class=\"display-flex flex-column justify-content-center align-items-center margin-bottom-20\"><label>Count:</label><div class=\"h2 margin-0\">0</div></div><div class=\"form-group display-flex gap-10\"><input class=\"form-control\" value=\"1000\"><button class=\"btn btn-default\" type=\"button\">Stop</button></div></div></div>",
|
|
22
|
+
"tabs": [
|
|
23
|
+
{
|
|
24
|
+
"label": "React",
|
|
25
|
+
"language": "tsx",
|
|
26
|
+
"code": "import { useState } from 'react';\n\nimport useInterval from '@rio-cloud/rio-uikit/useInterval';\n\nexport default () => {\n const [count, setCount] = useState(0);\n const [delay, setDelay] = useState(1000);\n const [isRunning, setIsRunning] = useState(true);\n\n useInterval(\n () => {\n // Your custom logic here\n setCount(count + 1);\n },\n isRunning ? delay : null\n );\n\n return (\n <div className='display-flex flex-column justify-content-center align-items-center'>\n <div className='display-flex flex-column justify-content-center align-items-center margin-bottom-20'>\n <label>Count:</label>\n <div className='h2 margin-0'>{count}</div>\n </div>\n <div className='form-group display-flex gap-10'>\n <input\n className='form-control'\n value={delay}\n onChange={event => setDelay(Number(event.target.value))}\n />\n <button className='btn btn-default' type='button' onClick={() => setIsRunning(!isRunning)}>\n {isRunning ? 'Stop' : 'Start'}\n </button>\n </div>\n </div>\n );\n};"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "HTML",
|
|
30
|
+
"language": "html",
|
|
31
|
+
"code": "<div class=\"display-flex flex-column justify-content-center align-items-center\">\n <div class=\"display-flex flex-column justify-content-center align-items-center margin-bottom-20\">\n <label>Count:</label>\n <div class=\"h2 margin-0\">0</div>\n </div>\n <div class=\"form-group display-flex gap-10\">\n <input class=\"form-control\" value=\"1000\">\n <button class=\"btn btn-default\" type=\"button\">Stop</button>\n </div>\n</div>"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"label": "Props",
|
|
35
|
+
"language": "json",
|
|
36
|
+
"code": null,
|
|
37
|
+
"props": [
|
|
38
|
+
{
|
|
39
|
+
"heading": null,
|
|
40
|
+
"rows": [
|
|
41
|
+
{
|
|
42
|
+
"name": "callback",
|
|
43
|
+
"type": "Function",
|
|
44
|
+
"default": "",
|
|
45
|
+
"description": "The callback function to be triggered."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "delay",
|
|
49
|
+
"type": "Number",
|
|
50
|
+
"default": "",
|
|
51
|
+
"description": "The time to wait until the callback function gets invoked."
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"see_also": []
|
|
63
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"captured_at": "2025-11-21T12:08:40.454Z",
|
|
4
|
+
"source": "https://uikit.developers.rio.cloud/#utilities/useIsFocusWithin",
|
|
5
|
+
"category": "Utilities",
|
|
6
|
+
"section": "DOM behavior hooks",
|
|
7
|
+
"slug": "utilities/useisfocuswithin",
|
|
8
|
+
"version": "v1.13.2",
|
|
9
|
+
"hash_algorithm": "sha256",
|
|
10
|
+
"hash": "6a1148ba89e85613f7345728d0020dcc5cac2dfb25b2126267b809e8455255b5"
|
|
11
|
+
},
|
|
12
|
+
"title": "useIsFocusWithin",
|
|
13
|
+
"lead": "The useIsFocusWithin hook allows you to detect whether the focus is currently within a specific element or any of its children. This is useful for managing focus-based behavior like showing or hiding UI elements, styling active areas, or triggering accessibility behavior.",
|
|
14
|
+
"content": [
|
|
15
|
+
{
|
|
16
|
+
"heading": "useIsFocusWithin",
|
|
17
|
+
"body": "It provides a boolean flag isFocusedWithin and a ref you can attach to any container. Optionally, you can provide callbacks for when focus enters or leaves the container, and configure a delay for blur detection.",
|
|
18
|
+
"examples": [
|
|
19
|
+
{
|
|
20
|
+
"caption": "Example 1",
|
|
21
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><div class=\"max-width-400 padding-20 border border-color-lighter rounded bg-lightest\"><div class=\"text-medium text-size-16 text-color-darker margin-bottom-15\">Click inside or outside</div><div><label for=\"simpleInput1\" class=\"display-inline-block\"><span>Simple input 1</span></label><div class=\"ClearableInput input-group\"><input id=\"simpleInput1\" class=\"form-control\" type=\"text\" tabindex=\"0\" value=\"\"><span class=\"clearButton hide\"><span class=\"clearButtonIcon rioglyph rioglyph-remove-sign\"></span></span></div></div><div><label for=\"simpleInput2\" class=\"display-inline-block\"><span>Simple input 2</span></label><div class=\"ClearableInput input-group\"><input id=\"simpleInput2\" class=\"form-control\" type=\"text\" tabindex=\"0\" value=\"\"><span class=\"clearButton hide\"><span class=\"clearButtonIcon rioglyph rioglyph-remove-sign\"></span></span></div></div></div><div class=\"margin-top-15 text-size-16 text-italic text-color-darker\">Focus is outside the block</div></div></div>",
|
|
22
|
+
"tabs": [
|
|
23
|
+
{
|
|
24
|
+
"label": "React",
|
|
25
|
+
"language": "tsx",
|
|
26
|
+
"code": "import ClearableInput from '@rio-cloud/rio-uikit/ClearableInput';\nimport FormLabel from '@rio-cloud/rio-uikit/FormLabel';\nimport useIsFocusWithin from '@rio-cloud/rio-uikit/useIsFocusWithin';\n\nexport default () => {\n const { ref, isFocusedWithin } = useIsFocusWithin<HTMLDivElement>({\n onFocusWithin: () => console.log('Entered component'),\n onBlurWithin: () => console.log('Left component'),\n delay: 100, // optional\n });\n\n return (\n <div>\n <div\n ref={ref}\n className={`max-width-400 padding-20 border ${isFocusedWithin ? 'border-color-primary' : 'border-color-lighter'} rounded bg-lightest`}\n >\n <div className='text-medium text-size-16 text-color-darker margin-bottom-15'>\n Click inside or outside\n </div>\n <div>\n <FormLabel htmlFor='simpleInput1'>Simple input 1</FormLabel>\n <ClearableInput id='simpleInput1' />\n </div>\n <div>\n <FormLabel htmlFor='simpleInput2'>Simple input 2</FormLabel>\n <ClearableInput id='simpleInput2' />\n </div>\n </div>\n <div className='margin-top-15 text-size-16 text-italic text-color-darker'>\n {isFocusedWithin ? 'Focus is within the block' : 'Focus is outside the block'}\n </div>\n </div>\n );\n};"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "HTML",
|
|
30
|
+
"language": "html",
|
|
31
|
+
"code": "<div>\n <div class=\"max-width-400 padding-20 border border-color-lighter rounded bg-lightest\">\n <div class=\"text-medium text-size-16 text-color-darker margin-bottom-15\">Click inside or outside</div>\n <div>\n <label for=\"simpleInput1\" class=\"display-inline-block\">\n <span>Simple input 1</span>\n </label>\n <div class=\"ClearableInput input-group\">\n <input id=\"simpleInput1\" class=\"form-control\" type=\"text\" tabindex=\"0\" value=\"\">\n <span class=\"clearButton hide\">\n <span class=\"clearButtonIcon rioglyph rioglyph-remove-sign\">\n </span>\n </span>\n </div>\n </div>\n <div>\n <label for=\"simpleInput2\" class=\"display-inline-block\">\n <span>Simple input 2</span>\n </label>\n <div class=\"ClearableInput input-group\">\n <input id=\"simpleInput2\" class=\"form-control\" type=\"text\" tabindex=\"0\" value=\"\">\n <span class=\"clearButton hide\">\n <span class=\"clearButtonIcon rioglyph rioglyph-remove-sign\">\n </span>\n </span>\n </div>\n </div>\n </div>\n <div class=\"margin-top-15 text-size-16 text-italic text-color-darker\">Focus is outside the block</div>\n</div>"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"label": "Props",
|
|
35
|
+
"language": "json",
|
|
36
|
+
"code": null,
|
|
37
|
+
"props": [
|
|
38
|
+
{
|
|
39
|
+
"heading": null,
|
|
40
|
+
"rows": [
|
|
41
|
+
{
|
|
42
|
+
"name": "ref",
|
|
43
|
+
"type": "React.RefObject<HTMLElement>",
|
|
44
|
+
"default": "",
|
|
45
|
+
"description": "Optional ref to an existing DOM element. If not provided, the hook will return its own ref."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "onFocusWithin",
|
|
49
|
+
"type": "Function",
|
|
50
|
+
"default": "",
|
|
51
|
+
"description": "Callback triggered when focus enters the target element or any of its children."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "onBlurWithin",
|
|
55
|
+
"type": "Function",
|
|
56
|
+
"default": "",
|
|
57
|
+
"description": "Callback triggered when focus leaves the target element and all of its children."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "delay",
|
|
61
|
+
"type": "number",
|
|
62
|
+
"default": "",
|
|
63
|
+
"description": "Optional delay in milliseconds before calling onBlurWithin. Useful when focus quickly shifts inside the container."
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"see_also": []
|
|
75
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"captured_at": "2025-11-21T12:08:40.454Z",
|
|
4
|
+
"source": "https://uikit.developers.rio.cloud/#utilities/useKey",
|
|
5
|
+
"category": "Utilities",
|
|
6
|
+
"section": "DOM behavior hooks",
|
|
7
|
+
"slug": "utilities/usekey",
|
|
8
|
+
"version": "v1.13.2",
|
|
9
|
+
"hash_algorithm": "sha256",
|
|
10
|
+
"hash": "6aaba83c62a943b75f8b7e16a89b610580479350fd3d0102cc88197a1e750220"
|
|
11
|
+
},
|
|
12
|
+
"title": "useKey",
|
|
13
|
+
"lead": "The useKey hook allows to easily detect key events. It can be used in two ways, either to specify a specific key to listen for or with a callback to listen for all keys.",
|
|
14
|
+
"content": [
|
|
15
|
+
{
|
|
16
|
+
"heading": "useKey",
|
|
17
|
+
"body": "",
|
|
18
|
+
"examples": [
|
|
19
|
+
{
|
|
20
|
+
"caption": "Example 1",
|
|
21
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div class=\"display-flex flex-column justify-content-center align-items-center\"><div class=\"display-flex justify-content-center align-items-center height-50\"><div class=\"margin-right-10\">Key</div><div class=\"label label-default\"> </div><div class=\"margin-left-10\">pressed</div></div><div class=\"display-flex justify-content-center align-items-center height-50\"><div class=\"margin-right-10\">Key</div><div class=\"label label-default\"> </div><div class=\"margin-left-10\">pressed</div></div><div class=\"display-flex justify-content-center align-items-center height-50\"><div class=\"margin-right-10\">Key</div><div class=\"label label-default\"> </div><div class=\"margin-left-10\">pressed</div></div></div></div>",
|
|
22
|
+
"tabs": [
|
|
23
|
+
{
|
|
24
|
+
"label": "React",
|
|
25
|
+
"language": "tsx",
|
|
26
|
+
"code": "import React, { useState } from 'react';\n\nimport useKey from '@rio-cloud/rio-uikit/useKey';\n\nconst Usage1 = () => {\n const [pressedKey, setPressedKey] = useState(' ');\n\n // Use the useKey hook to listen for any key presses\n useKey(event => {\n console.log(event);\n event.key === ' ' ? setPressedKey(event.code) : setPressedKey(event.key);\n });\n\n return (\n <div className='display-flex justify-content-center align-items-center height-50'>\n <div className='margin-right-10'>Key</div>\n <div className='label label-default'>{pressedKey}</div>\n <div className='margin-left-10'>pressed</div>\n </div>\n );\n};\n\nconst Usage2 = () => {\n const [pressedKey, setPressedKey] = useState(' ');\n\n // Use the useKey hook to listen for any key presses with optional event types\n useKey(\n event => {\n if (event.shiftKey) {\n setPressedKey(`Shift + ${event.key}`);\n } else if (event.metaKey) {\n setPressedKey(`Cmd + ${event.key}`);\n } else if (event.key === ' ') {\n setPressedKey(event.code);\n } else {\n setPressedKey(event.key);\n }\n },\n ['keyup'] // Listens for the 'keyup' event\n );\n\n return (\n <div className='display-flex justify-content-center align-items-center height-50'>\n <div className='margin-right-10'>Key</div>\n <div className='label label-default'>{pressedKey}</div>\n <div className='margin-left-10'>pressed</div>\n </div>\n );\n};\n\nconst Usage3 = () => {\n const [pressedKey, setPressedKey] = useState(' ');\n\n // Use the useKey hook to listen for the Enter key press\n useKey('Enter', event => {\n console.log('Enter key pressed');\n setPressedKey('Enter');\n });\n\n return (\n <div className='display-flex justify-content-center align-items-center height-50'>\n <div className='margin-right-10'>Key</div>\n <div className='label label-default'>{pressedKey}</div>\n <div className='margin-left-10'>pressed</div>\n </div>\n );\n};\n\nexport default () => {\n return (\n <div className='display-flex flex-column justify-content-center align-items-center'>\n <Usage1 />\n <Usage2 />\n <Usage3 />\n </div>\n );\n};"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "HTML",
|
|
30
|
+
"language": "html",
|
|
31
|
+
"code": "<div class=\"display-flex flex-column justify-content-center align-items-center\">\n <div class=\"display-flex justify-content-center align-items-center height-50\">\n <div class=\"margin-right-10\">Key</div>\n <div class=\"label label-default\"> </div>\n <div class=\"margin-left-10\">pressed</div>\n </div>\n <div class=\"display-flex justify-content-center align-items-center height-50\">\n <div class=\"margin-right-10\">Key</div>\n <div class=\"label label-default\"> </div>\n <div class=\"margin-left-10\">pressed</div>\n </div>\n <div class=\"display-flex justify-content-center align-items-center height-50\">\n <div class=\"margin-right-10\">Key</div>\n <div class=\"label label-default\"> </div>\n <div class=\"margin-left-10\">pressed</div>\n </div>\n</div>"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"label": "Props",
|
|
35
|
+
"language": "json",
|
|
36
|
+
"code": null,
|
|
37
|
+
"props": [
|
|
38
|
+
{
|
|
39
|
+
"heading": null,
|
|
40
|
+
"rows": [
|
|
41
|
+
{
|
|
42
|
+
"name": "keyOrCallback",
|
|
43
|
+
"type": "string | ((event: KeyboardEvent) => void)",
|
|
44
|
+
"default": "",
|
|
45
|
+
"description": "Either a key string (e.g., \"Enter\") or a callback function"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "callbackOrEventTypes",
|
|
49
|
+
"type": "(event: KeyboardEvent) => void | KeyboardEventType[]",
|
|
50
|
+
"default": "",
|
|
51
|
+
"description": "If the first argument is a key, this should be the callback function. If the first argument is a callback, this is an optional array of event types."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "eventTypesOrNode",
|
|
55
|
+
"type": "KeyboardEventType[] | Document",
|
|
56
|
+
"default": "[keydown]",
|
|
57
|
+
"description": "If the first argument is a key, this should be an array of event types. If the first argument is a callback, this is the node (defaults to document)."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "node",
|
|
61
|
+
"type": "Node",
|
|
62
|
+
"default": "document",
|
|
63
|
+
"description": "Optional DOM node to attach the event listener to (defaults to document)."
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"see_also": []
|
|
75
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"captured_at": "2025-11-21T12:08:43.953Z",
|
|
4
|
+
"source": "https://uikit.developers.rio.cloud/#utilities/useLocalStorage",
|
|
5
|
+
"category": "Utilities",
|
|
6
|
+
"section": "Browser & device hooks",
|
|
7
|
+
"slug": "utilities/uselocalstorage",
|
|
8
|
+
"version": "v1.13.2",
|
|
9
|
+
"hash_algorithm": "sha256",
|
|
10
|
+
"hash": "c494bf9e7495b9d01601349106a5ddb5487ad590086dfd74649434bc37385643"
|
|
11
|
+
},
|
|
12
|
+
"title": "useLocalStorage / useSessionStorage",
|
|
13
|
+
"lead": "The useLocalStorage and the useSessionStorage hook allows to save custom data in the respective storage locations.",
|
|
14
|
+
"content": [
|
|
15
|
+
{
|
|
16
|
+
"heading": "useLocalStorage / useSessionStorage",
|
|
17
|
+
"body": "",
|
|
18
|
+
"examples": [
|
|
19
|
+
{
|
|
20
|
+
"caption": "Example 1",
|
|
21
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><div class=\"margin-bottom-15\"><div>Tom - 26</div><div>{\n \"enableBuyOption\": true\n}</div></div><div class=\"btn-toolbar\"><button type=\"button\" class=\"btn btn-default btn-component\" tabindex=\"0\">Set Name</button><button type=\"button\" class=\"btn btn-default btn-component\" tabindex=\"0\">Set Age</button><button type=\"button\" class=\"btn btn-default btn-component\" tabindex=\"0\">Remove Name</button><button type=\"button\" class=\"btn btn-default btn-component\" tabindex=\"0\">Remove Age</button><button type=\"button\" class=\"btn btn-default btn-component\" tabindex=\"0\">Toggle Settings</button></div></div></div>",
|
|
22
|
+
"tabs": [
|
|
23
|
+
{
|
|
24
|
+
"label": "React",
|
|
25
|
+
"language": "tsx",
|
|
26
|
+
"code": "import Button from '@rio-cloud/rio-uikit/Button';\nimport useLocalStorage from '@rio-cloud/rio-uikit/useLocalStorage';\nimport useSessionStorage from '@rio-cloud/rio-uikit/useSessionStorage';\n\nexport default () => {\n const [name, setName, removeName] = useSessionStorage('name', 'Tom');\n\n const [age, setAge, removeAge] = useLocalStorage('age', 26);\n const [settings, setSettings] = useLocalStorage('uikit.demo.settings', { enableBuyOption: true });\n\n return (\n <div>\n <div className='margin-bottom-15'>\n <div>\n {name} - {age}\n </div>\n <div>{JSON.stringify(settings, null, 1)}</div>\n </div>\n <div className='btn-toolbar'>\n <Button onClick={() => setName('John')}>Set Name</Button>\n <Button onClick={() => setAge(40)}>Set Age</Button>\n <Button onClick={removeName}>Remove Name</Button>\n <Button onClick={removeAge}>Remove Age</Button>\n <Button onClick={() => setSettings({ ...settings, enableBuyOption: !settings?.enableBuyOption })}>\n Toggle Settings\n </Button>\n </div>\n </div>\n );\n};"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "HTML",
|
|
30
|
+
"language": "html",
|
|
31
|
+
"code": "<div>\n <div class=\"margin-bottom-15\">\n <div>Tom - 26</div>\n <div>{\n \"enableBuyOption\": true\n }</div>\n </div>\n <div class=\"btn-toolbar\">\n <button type=\"button\" class=\"btn btn-default btn-component\" tabindex=\"0\">Set Name</button>\n <button type=\"button\" class=\"btn btn-default btn-component\" tabindex=\"0\">Set Age</button>\n <button type=\"button\" class=\"btn btn-default btn-component\" tabindex=\"0\">Remove Name</button>\n <button type=\"button\" class=\"btn btn-default btn-component\" tabindex=\"0\">Remove Age</button>\n <button type=\"button\" class=\"btn btn-default btn-component\" tabindex=\"0\">Toggle Settings</button>\n </div>\n</div>"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"label": "Props",
|
|
35
|
+
"language": "json",
|
|
36
|
+
"code": null,
|
|
37
|
+
"props": [
|
|
38
|
+
{
|
|
39
|
+
"heading": null,
|
|
40
|
+
"rows": [
|
|
41
|
+
{
|
|
42
|
+
"name": "key",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"default": "",
|
|
45
|
+
"description": "The key used for storing and retrieving values from the storage."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "defaultValue",
|
|
49
|
+
"type": "any",
|
|
50
|
+
"default": "",
|
|
51
|
+
"description": "The initial default value to be stored. If passed a function, it gets executed."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "[value, setValue, removeValue]",
|
|
55
|
+
"type": "[any, Function, Function]",
|
|
56
|
+
"default": "",
|
|
57
|
+
"description": "Returns the stored value and two functions for setting and removing the value from the storage."
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"see_also": []
|
|
69
|
+
}
|