File tree Expand file tree Collapse file tree 4 files changed +77
-0
lines changed
components/content/examples/aspectratio Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Original file line number Diff line number Diff line change
1
+ <template >
2
+ <CAspectRatio max-w =" 400px" :ratio =" 4 / 3" >
3
+ <CImage src =" https://bit.ly/naruto-sage" alt =" sage mode naruto" object-fit =" cover" />
4
+ </CAspectRatio >
5
+ </template >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <CAspectRatio :ratio =" 16 / 9" >
3
+ <CBox as =" iframe"
4
+ src =" https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d126614.51346341768!2d3.8226594639678577!3d7.387080139026444!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x10398d77eeff086f%3A0x3b33e0f76e8e04a9!2sIbadan%2C%20Oyo!5e0!3m2!1sen!2sng!4v1689540977837!5m2!1sen!2sng"
5
+ frameborder =" 0" aria-hidden =" false" tabindex =" 0" alt =" Ibadan, Nigeria" allow-full-screen />
6
+ </CAspectRatio >
7
+ </template >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <CAspectRatio max-w =" 600px" max-h =" 300px" :ratio =" 4 / 3" >
3
+ <CBox as =" iframe" w =" 600px" h =" 500px"
4
+ title =" Sybren Willemot - Can you build a design system with Chakra UI Vue? - Vuejs Amsterdam 2023"
5
+ src =" https://www.youtube.com/embed/UL9Fcx6qDdk" allow-full-screen />
6
+ </CAspectRatio >
7
+ </template >
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Aspect Ratio
3
+ description : Aspect ratio component
4
+ version : 2.0+
5
+ ---
6
+
7
+ # Aspect Ratio
8
+
9
+ ` CAspectRatio ` component is used to embed responsive videos and maps, etc.
10
+
11
+ ## Import
12
+
13
+ ``` js
14
+ import { CAspectRatio } from ' @chakra-ui/vue-next' ;
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ### Embed Video
20
+
21
+ To embed a video with a specific aspect ratio, use a ` CBox ` as an ` iframe ` with src pointing to the link of the video.
22
+
23
+ Pass the ` max-width ` prop to ` CAspectRatio ` to control the width of the content.
24
+
25
+ :: showcase
26
+ :: aspect-ratio-e-video { width =full }
27
+ ::
28
+ ::
29
+
30
+ ``` html
31
+ <CAspectRatio max-w =" 600px" max-h =" 300px" :ratio =" 4 / 3" >
32
+ <CBox as =" iframe" w =" 600px" h =" 500px" title =" Chakra UI Vue" src =" https://www.youtube.com/embed/UL9Fcx6qDdk" allow-full-screen />
33
+ </CAspectRatio >
34
+ ```
35
+
36
+ ### Embed Image
37
+
38
+ You can also embed image that has a 4:3 aspect ratio.
39
+
40
+ :: showcase
41
+ :: aspect-ratio-e-image { width =full }
42
+ ::
43
+ ::
44
+
45
+ ``` html
46
+ <CAspectRatio max-w =" 400px" :ratio =" 4 / 3" >
47
+ <CImage src =" https://bit.ly/naruto-sage" alt =" sage mode naruto" object-fit =" cover" />
48
+ </CAspectRatio >
49
+ ```
50
+
51
+ ### Embed a responsive map
52
+
53
+ Here's how to embed a responsive Google map using ` CAspectRatio ` . To make the map take up the entire width, we can ignore the max-width prop.
54
+
55
+ :: showcase
56
+ :: aspect-ratio-e-map { width =full }
57
+ ::
58
+ ::
You can’t perform that action at this time.
0 commit comments