@@ -14,30 +14,31 @@ available in four versions:
14
14
15
15
When using an error type,
16
16
17
+ ### Usage
18
+
17
19
```vue
18
20
<template>
19
21
<div>
20
- <NcNoteCard type="warning">
21
- <p>This is dangerous</p>
22
- </NcNoteCard>
22
+ <NcNoteCard type="warning" text="This is dangerous" />
23
23
24
- <NcNoteCard type="error" heading="Error">
25
- <p>The server is not happy and reported the following error</p>
26
- </NcNoteCard >
24
+ <NcNoteCard type="error"
25
+ heading="Error"
26
+ text="The server is not happy and reported the following error" / >
27
27
28
- <NcNoteCard type="success">
29
- <p>You won</p>
30
- </NcNoteCard>
28
+ <NcNoteCard type="success" text="You won" />
31
29
32
- <NcNoteCard type="info">
33
- <p>For your information</p>
34
- </NcNoteCard>
30
+ <NcNoteCard type="info" text="For your information" />
35
31
36
- <NcNoteCard type="warning">
32
+ <h4>Custom icon</h4>
33
+ <NcNoteCard type="warning" text="Custom icon usage">
37
34
<template #icon>
38
35
<Cog :size="20"/>
39
36
</template>
40
- <p>Custom icon usage</p>
37
+ </NcNoteCard>
38
+
39
+ <h4>Custom content using the default slot</h4>
40
+ <NcNoteCard type="info">
41
+ Press <kbd>CTRL</kbd>+<kbd>C</kbd>
41
42
</NcNoteCard>
42
43
</div>
43
44
</template>
@@ -69,7 +70,12 @@ When using an error type,
69
70
<h2 v-if="heading">
70
71
{{ heading }}
71
72
</h2>
72
- <slot />
73
+ <!-- @slot The main content (overwrites the `text` prop) -->
74
+ <slot>
75
+ <p class="notecard__text">
76
+ {{ text }}
77
+ </p>
78
+ </slot>
73
79
</div>
74
80
</div>
75
81
</template>
@@ -100,6 +106,13 @@ export default {
100
106
type: String,
101
107
default: '',
102
108
},
109
+ /**
110
+ * The message text of the note card
111
+ */
112
+ text: {
113
+ type: String,
114
+ default: '',
115
+ },
103
116
},
104
117
computed: {
105
118
shouldShowAlert() {
0 commit comments