Docs for Messages

pull/12/head
cagataycivici 2019-05-23 13:56:51 +03:00
parent 74f94e74a3
commit d83ad99e0c
2 changed files with 149 additions and 79 deletions

View File

@ -20,7 +20,7 @@
<Message v-for="msg of messages" :severity="msg.severity" :key="msg.content">{{msg.content}}</Message> <Message v-for="msg of messages" :severity="msg.severity" :key="msg.content">{{msg.content}}</Message>
<h3>Auto Dismiss</h3> <h3>Auto Dismiss</h3>
<Message severity="warn" :life="5000" :sticky="false">This message will hide in 5 seconds.</Message> <Message severity="warn" :life="10000" :sticky="false">This message will hide in 10 seconds.</Message>
<h3>Validation Message</h3> <h3>Validation Message</h3>
<div class="p-grid"> <div class="p-grid">

View File

@ -5,12 +5,16 @@
<h3>Import</h3> <h3>Import</h3>
<CodeHighlight lang="javascript"> <CodeHighlight lang="javascript">
import Message from 'primevue/message'; import Message from 'primevue/message';
import ValidationMessage from 'primevue/validationmessage';
</CodeHighlight> </CodeHighlight>
<h3>Getting Started</h3> <h3>Getting Started</h3>
<p>A single message is specified by Message interface in PrimeVue that defines the severity and content as the properties. <p>Message component requires a content to display.</p>
Messages to display can either be defined using the value property which should an array of Message instances.</p> <CodeHighlight>
&lt;Message&gt;Welcome to PrimeVue&lt;/Message&gt;
</CodeHighlight>
<p>Multiple messages can be displayed using the standard v-for directive.</p>
<CodeHighlight> <CodeHighlight>
<template v-pre> <template v-pre>
&lt;Message v-for="msg of messages" :severity="msg.severity" :key="msg.content"&gt;{{msg.content}}&lt;/Message&gt; &lt;Message v-for="msg of messages" :severity="msg.severity" :key="msg.content"&gt;{{msg.content}}&lt;/Message&gt;
@ -30,7 +34,7 @@ data() {
</CodeHighlight> </CodeHighlight>
<h3>Severities</h3> <h3>Severities</h3>
<p>There are four possible values for the severity of a message.</p> <p>There are four possible values for the severity of a message. Default one is "info".</p>
<ul> <ul>
<li>success</li> <li>success</li>
@ -46,13 +50,17 @@ data() {
</CodeHighlight> </CodeHighlight>
<h3>Sticky</h3> <h3>Sticky</h3>
<p>Messages are cleared automatically after the timeout defined by <i>life</i> property which is 3 seconds by default. Use <i>sticky</i> mode to make them stay until <p>Messages are sticky by default, if you require them to be cleared automatically, disable <i>sticky</i> property and optionally configure the <i>life</i> property to specify how long the message
they are manually removed.</p> should be displayed which is 3000 ms by default.</p>
<CodeHighlight> <CodeHighlight>
&lt;Message severity="warn" :life="5000" :sticky="false"&gt;This message will hide in 5 seconds.&lt;/Message&gt; &lt;Message severity="warn" :life="5000" :sticky="false"&gt;This message will hide in 5 seconds.&lt;/Message&gt;
</CodeHighlight> </CodeHighlight>
<h3>ValidationMessage Component</h3> <h3>ValidationMessage Component</h3>
<CodeHighlight lang="javascript">
import Message from 'primevue/message';
</CodeHighlight>
<p>ValidationMessage component is useful in cases where a single message needs to be displayed related to an element such as forms. It has one property, <i>severity</i> of the message.</p> <p>ValidationMessage component is useful in cases where a single message needs to be displayed related to an element such as forms. It has one property, <i>severity</i> of the message.</p>
<CodeHighlight> <CodeHighlight>
&lt;InputText placeholder="Username" class="p-error" /&gt; &lt;InputText placeholder="Username" class="p-error" /&gt;
@ -100,8 +108,32 @@ data() {
</table> </table>
</div> </div>
<h3>Properties of ValidationMessage</h3>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>severity</td>
<td>string</td>
<td>info</td>
<td>Severity level of the message.</td>
</tr>
</tbody>
</table>
</div>
<h3>Styling</h3> <h3>Styling</h3>
<p>Following is the list of structural style classes, for theming classes visit <router-link to="/theming">theming</router-link> page.</p> <p>Following is the list of structural style classes, for theming classes visit <router-link to="/theming">theming</router-link> page.</p>
<strong>Message</strong>
<div class="doc-tablewrapper"> <div class="doc-tablewrapper">
<table class="doc-table"> <table class="doc-table">
<thead> <thead>
@ -140,12 +172,50 @@ data() {
<td>Severity icon.</td> <td>Severity icon.</td>
</tr> </tr>
<tr> <tr>
<td>p-messages-summary</td> <td>p-messages-text</td>
<td>Summary of a message.</td> <td>Content of a message.</td>
</tr>
</tbody>
</table>
</div>
<strong>ValidationMessage</strong>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Name</th>
<th>Element</th>
</tr>
</thead>
<tbody>
<tr>
<td>p-message</td>
<td>Container element.</td>
</tr> </tr>
<tr> <tr>
<td>p-messages-detail</td> <td>p-message-info</td>
<td>Detail of a message.</td> <td>Container element when displaying info messages.</td>
</tr>
<tr>
<td>p-message-warn</td>
<td>Container element when displaying warning messages.</td>
</tr>
<tr>
<td>p-message-error</td>
<td>Container element when displaying error messages.</td>
</tr>
<tr>
<td>p-message-success</td>
<td>Container element when displaying success messages.</td>
</tr>
<tr>
<td>p-message-icon</td>
<td>Severity icon.</td>
</tr>
<tr>
<td>p-message-text</td>
<td>Content of a message.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -183,7 +253,7 @@ data() {
&lt;Message v-for="msg of messages" :severity="msg.severity" :key="msg.content"&gt;{{msg.content}}&lt;/Message&gt; &lt;Message v-for="msg of messages" :severity="msg.severity" :key="msg.content"&gt;{{msg.content}}&lt;/Message&gt;
&lt;h3&gt;Auto Dismiss&lt;/h3&gt; &lt;h3&gt;Auto Dismiss&lt;/h3&gt;
&lt;Message severity="warn" :life="5000" :sticky="false"&gt;This message will hide in 5 seconds.&lt;/Message&gt; &lt;Message severity="warn" :life="10000" :sticky="false"&gt;This message will hide in 10 seconds.&lt;/Message&gt;
&lt;h3&gt;Validation Message&lt;/h3&gt; &lt;h3&gt;Validation Message&lt;/h3&gt;
&lt;div class="p-grid"&gt; &lt;div class="p-grid"&gt;