diff --git a/src/components/image/Image.d.ts b/src/components/image/Image.d.ts
index 539276c9d..e1aa4cbfd 100644
--- a/src/components/image/Image.d.ts
+++ b/src/components/image/Image.d.ts
@@ -1,9 +1,14 @@
+import { VNode } from 'vue';
+
interface ImageProps {
preview?: boolean;
}
declare class Image {
$props: ImageProps;
+ $slots: {
+ indicator: VNode[];
+ }
}
export default Image;
diff --git a/src/views/image/ImageDemo.vue b/src/views/image/ImageDemo.vue
index b52dd1dd7..142d1a47b 100644
--- a/src/views/image/ImageDemo.vue
+++ b/src/views/image/ImageDemo.vue
@@ -14,7 +14,7 @@
A model can be bound using the standard v-model directive.
+Image is used as the native img element and supports all properties that the native element has.
-<InputText type="text" v-model="value" />
+<Image src="image1.png" alt="Image Text" />
- A floating label is implemented by wrapping the input and the label inside a container having .p-float-label style class.
+Preview mode displays a modal layer when the image is clicked that provides transformation options such as rotating and zooming.
+ +An eye icon is displayed by default when the image is hovered in preview mode. Use the indicator template for custom content.
-<span class="p-float-label">
- <InputText id="username" type="text" v-model="value" />
- <label for="username">Username</label>
-</span>
-
-
-
- An icon can be integrated within an input field by wrapping the input and the icon with an element having p-input-icon-right - and p-input-icon-left classes depending on the icon location.
-
-<span class="p-input-icon-left">
- <i class="pi pi-search" />
- <InputText type="text" v-model="value1" placeholder="Search" />
-</span>
-
-<span class="p-input-icon-right">
- <InputText type="text" v-model="value2" />
- <i class="pi pi-spin pi-spinner" />
-</span>
-
-<span class="p-input-icon-left p-input-icon-right">
- <i class="pi pi-search" />
- <InputText type="text" v-model="value3" />
- <i class="pi pi-spin pi-spinner" />
-</span>
-
-
-
- 2 more sizes are available in addition to a regular input, for a smaller input add p-inputtext-sm and for a larger one, use p-inputtext-lg.
- Note that these classes are mainly be used to change the size of a particular field, for global scaling see the
-<InputText type="text" class="p-inputtext-sm" placeholder="Small" />
-<InputText type="text" placeholder="Normal" />
-<InputText type="text" class="p-inputtext-lg" placeholder="Large" />
-
-
-
- Instead of repeating the scale classes for each input, sizing can also be applied to a group by adding the - class to a container element so that descendant inputs share the same style easier.
-
-<div class="p-inputtext-sm">
- <InputText />
- <InputNumber />
- <InputMask />
-</div>
-
-
-
- Input fields come in two styles, default is outlined with borders around the field whereas filled alternative adds a background color - to the field. Applying p-input-filled to an ancestor of an input enables the filled style. If you prefer - to use filled inputs in the entire application, use a global container such as document body or the application element to apply the style class.
- -
-<div class="p-input-filled">
- <InputText type="text" />
- <InputText type="text" />
- <InputText type="text" />
-</div>
+<Image src="image1.png" alt="Image Text">
+ <template #indicator>
+ Preview Content
+ </template>
+</Image>
InputText passes any valid attribute to the underlying input element, additional attribute is the following.
+Image passes any valid attribute to the underlying img element, additional attribute is the following.
modelValue | -any | -null | -Value of the component. | +preview | +boolean | +false | +Controls the preview functionality. |
Any valid event such as focus, blur and input are passed to the underlying input element.
+Any valid event like click and mouseover are passed to the underlying input element. Events below are the additional ones related to the preview functionality.
+Name | +Parameters | +Description | +
---|---|---|
show | +- | +Triggered when the preview overlay is shown. | +
hide | +- | +Triggered when the preview overlay is hidden. | +
Name | +Parameters | +
---|---|
indicator | +- | +
Following is the list of structural style classes, for theming classes visit