Skip to content

Commit

Permalink
Add doc strings with examples to new components
Browse files Browse the repository at this point in the history
Modify commit message

Signed-off-by: Phillip Rak <[email protected]>
  • Loading branch information
rak-phillip committed Jan 31, 2025
1 parent 2e8927c commit fee3060
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/rancher-components/src/components/RcButton/RcButton.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<script setup lang="ts">
/**
* A button element used for performing actions, such as submitting forms or
* opening dialogs.
*
* Example:
*
* <rc-button primary @click="doAction">Perform an Action</rc-button>
*/
import { computed, ref, defineExpose } from 'vue';
import { ButtonRoleProps, ButtonSizeProps } from './types';
Expand Down
21 changes: 21 additions & 0 deletions pkg/rancher-components/src/components/RcDropdown/RcDropdown.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
<script setup lang="ts">
/**
* Offers a list of choices to the user, such as a set of actions or functions.
* Opened by activating RcDropdownTrigger.
*
* Example:
*
* <rc-dropdown :aria-label="t('nav.actionMenu.label')">
* <rc-dropdown-trigger tertiary>
* <i class="icon icon-actions" />
* </rc-dropdown-trigger>
* <template #dropdownCollection>
* <rc-dropdown-item @click="performAction()">
* Action 1
* </rc-dropdown-item>
* <rc-dropdown-separator />
* <rc-dropdown-item @click="performAction()">
* Action 2
* </rc-dropdown-item>
* </template>
* </rc-dropdown>
*/
import { useTemplateRef } from 'vue';
import { useClickOutside } from '@shell/composables/useClickOutside';
import { useDropdownContext } from '@components/RcDropdown/useDropdownContext';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<script setup lang="ts">
/**
* An item for a dropdown menu. Used in conjunction with RcDropdown.
*/
import { inject } from 'vue';
import { DropdownContext, defaultContext } from './types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<script setup lang="ts">
/**
* A button that opens a menu. Used in conjunction with `RcDropdown.vue`.
*/
import { inject, onMounted, useTemplateRef } from 'vue';
import { RcButton, RcButtonType } from '@components/RcButton';
import { DropdownContext, defaultContext } from './types';
Expand Down

0 comments on commit fee3060

Please sign in to comment.