Skip to content

docs(methods): update component method documentation #4145 #30495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3503975
docs(app): add param tag to setFocus method
soundproofboot Jun 9, 2025
d677274
docs(action-sheet): refactor documentation for dismiss method
soundproofboot Jun 9, 2025
94b7df1
docs(alert): refactor documentation for dismiss method
soundproofboot Jun 9, 2025
160968b
docs(datetime): add param tags to confirm, reset, and cancel methods
soundproofboot Jun 9, 2025
6b0154c
docs(loading): refactor documentation for dismiss method
soundproofboot Jun 9, 2025
fa0108a
docs(datetime): fix typo in method param tags
soundproofboot Jun 10, 2025
5cafafc
docs(menu): add param tags to open, close and toggle methods
soundproofboot Jun 10, 2025
b9fd8a2
docs(modal): add update documenation on setCurrentBreakpoint and dism…
soundproofboot Jun 10, 2025
dd643f9
docs(menu): add param tags to setOpen method
soundproofboot Jun 11, 2025
4556bec
docs(popover): update docs for present and dismiss methods
soundproofboot Jun 11, 2025
4d9743e
docs(reorder-group): remove new line from complete method
soundproofboot Jun 11, 2025
9db7a54
docs(router): add param tag to push method
soundproofboot Jun 11, 2025
ad35701
docs(searchbar): spacing in setFocus documentation
soundproofboot Jun 11, 2025
a505969
docs(toast): refactor documentation for dismiss method
soundproofboot Jun 11, 2025
294471a
docs(app): end param comment with period
soundproofboot Jun 23, 2025
7a52b38
docs(datetime): add clarity to startDate param
soundproofboot Jun 23, 2025
7403acf
docs(menu): word button to menu
soundproofboot Jun 23, 2025
5328e70
docs(menu): clarity in shouldOpen param
soundproofboot Jun 23, 2025
e6c7550
docs(menu): clarity in animated param
soundproofboot Jun 23, 2025
c42db79
docs(menu): clarity in animated param
soundproofboot Jun 23, 2025
406b804
docs(menu): clarity in animated param
soundproofboot Jun 23, 2025
b66df1c
docs(menu): clarity in animated param
soundproofboot Jun 23, 2025
62724e1
docs(modal): move note on breakpoints array
soundproofboot Jun 23, 2025
a3788d9
docs(popover): language in event param
soundproofboot Jun 23, 2025
5629fd3
docs(router): language in animation param
soundproofboot Jun 23, 2025
3d87651
chore(): build & lint
brandyscarney Jun 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 32 additions & 18 deletions core/src/components.d.ts

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions core/src/components/action-sheet/action-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,15 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {

/**
* Dismiss the action sheet overlay after it has been presented.
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
*
* @param data Any data to emit in the dismiss events.
* @param role The role of the element that is dismissing the action sheet.
* This can be useful in a button handler for determining which button was
* clicked to dismiss the action sheet.
* Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
*
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
* clicked to dismiss the action sheet. Some examples include:
* `"cancel"`, `"destructive"`, `"selected"`, and `"backdrop"`.
*/
@Method()
async dismiss(data?: any, role?: string): Promise<boolean> {
Expand Down
11 changes: 5 additions & 6 deletions core/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -432,16 +432,15 @@ export class Alert implements ComponentInterface, OverlayInterface {

/**
* Dismiss the alert overlay after it has been presented.
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
*
* @param data Any data to emit in the dismiss events.
* @param role The role of the element that is dismissing the alert.
* This can be useful in a button handler for determining which button was
* clicked to dismiss the alert.
* Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
*
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
* clicked to dismiss the alert. Some examples include:
* `"cancel"`, `"destructive"`, `"selected"`, and `"backdrop"`.
*/
@Method()
async dismiss(data?: any, role?: string): Promise<boolean> {
Expand Down
2 changes: 2 additions & 0 deletions core/src/components/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export class App implements ComponentInterface {
* a result of another user action. (Ex: We focus the first element
* inside of a popover when the user presents it, but the popover is not always
* presented as a result of keyboard action.)
*
* @param elements An array of HTML elements to set focus on.
*/
@Method()
async setFocus(elements: HTMLElement[]) {
Expand Down
6 changes: 6 additions & 0 deletions core/src/components/datetime/datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ export class Datetime implements ComponentInterface {
* Confirms the selected datetime value, updates the
* `value` property, and optionally closes the popover
* or modal that the datetime was presented in.
*
* @param closeOverlay If `true`, closes the parent overlay. Defaults to `false`.
*/
@Method()
async confirm(closeOverlay = false) {
Expand Down Expand Up @@ -559,6 +561,8 @@ export class Datetime implements ComponentInterface {
* Resets the internal state of the datetime but does not update the value.
* Passing a valid ISO-8601 string will reset the state of the component to the provided date.
* If no value is provided, the internal state will be reset to the clamped value of the min, max and today.
*
* @param startDate a valid [ISO-8601 string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format) to reset the datetime state to.
*/
@Method()
async reset(startDate?: string) {
Expand All @@ -570,6 +574,8 @@ export class Datetime implements ComponentInterface {
* optionally closes the popover
* or modal that the datetime was
* presented in.
*
* @param closeOverlay If `true`, closes the parent overlay. Defaults to `false`.
*/
@Method()
async cancel(closeOverlay = false) {
Expand Down
11 changes: 5 additions & 6 deletions core/src/components/loading/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,15 @@ export class Loading implements ComponentInterface, OverlayInterface {

/**
* Dismiss the loading overlay after it has been presented.
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
*
* @param data Any data to emit in the dismiss events.
* @param role The role of the element that is dismissing the loading.
* This can be useful in a button handler for determining which button was
* clicked to dismiss the loading.
* Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
*
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
* clicked to dismiss the loading. Some examples include:
* `"cancel"`, `"destructive"`, `"selected"`, and `"backdrop"`.
*/
@Method()
async dismiss(data?: any, role?: string): Promise<boolean> {
Expand Down
28 changes: 25 additions & 3 deletions core/src/components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export class Menu implements ComponentInterface, MenuI {
}

/**
* Returns `true` is the menu is active.
* Returns `true` if the menu is active.
*
* A menu is active when it can be opened or closed, meaning it's enabled
* and it's not part of a `ion-split-pane`.
Expand All @@ -366,6 +366,10 @@ export class Menu implements ComponentInterface, MenuI {
/**
* Opens the menu. If the menu is already open or it can't be opened,
* it returns `false`.
*
* @param animated If `true`, the menu will animate when opening.
* If `false`, the menu will open instantly without animation.
* Defaults to `true`.
*/
@Method()
open(animated = true): Promise<boolean> {
Expand All @@ -375,24 +379,42 @@ export class Menu implements ComponentInterface, MenuI {
/**
* Closes the menu. If the menu is already closed or it can't be closed,
* it returns `false`.
*
* @param animated If `true`, the menu will animate when closing. If `false`,
* the menu will close instantly without animation. Defaults to `true`.
* @param role The role of the element that is closing the menu.
* This can be useful in a button handler for determining which button was
* clicked to close the menu. Some examples include:
* `"cancel"`, `"destructive"`, `"selected"`, and `"backdrop"`.
*/
@Method()
close(animated = true, role?: string): Promise<boolean> {
return this.setOpen(false, animated, role);
}

/**
* Toggles the menu. If the menu is already open, it will try to close, otherwise it will try to open it.
* Toggles the menu. If the menu is already open, it will try to close,
* otherwise it will try to open it.
* If the operation can't be completed successfully, it returns `false`.
*
* @param animated If `true`, the menu will animate when opening/closing.
* If `false`, the menu will open/close instantly without animation.
* Defaults to `true`.
*/
@Method()
toggle(animated = true): Promise<boolean> {
return this.setOpen(!this._isOpen, animated);
}

/**
* Opens or closes the button.
* Opens or closes the menu.
* If the operation can't be completed successfully, it returns `false`.
*
* @param shouldOpen If `true`, the menu will open. If `false`, the menu
* will close.
* @param animated If `true`, the menu will animate when opening/closing.
* If `false`, the menu will open/close instantly without animation.
* @param role The role of the element that is closing the menu.
*/
@Method()
setOpen(shouldOpen: boolean, animated = true, role?: string): Promise<boolean> {
Expand Down
14 changes: 8 additions & 6 deletions core/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -739,13 +739,13 @@ export class Modal implements ComponentInterface, OverlayInterface {

/**
* Dismiss the modal overlay after it has been presented.
*
* @param data Any data to emit in the dismiss events.
* @param role The role of the element that is dismissing the modal. For example, 'cancel' or 'backdrop'.
*
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
*
* @param data Any data to emit in the dismiss events.
* @param role The role of the element that is dismissing the modal.
* For example, `cancel` or `backdrop`.
*/
@Method()
async dismiss(data?: any, role?: string): Promise<boolean> {
Expand Down Expand Up @@ -841,8 +841,10 @@ export class Modal implements ComponentInterface, OverlayInterface {
}

/**
* Move a sheet style modal to a specific breakpoint. The breakpoint value must
* be a value defined in your `breakpoints` array.
* Move a sheet style modal to a specific breakpoint.
*
* @param breakpoint The breakpoint value to move the sheet modal to.
* Must be a value defined in your `breakpoints` array.
*/
@Method()
async setCurrentBreakpoint(breakpoint: number): Promise<void> {
Expand Down
11 changes: 6 additions & 5 deletions core/src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ export class Popover implements ComponentInterface, PopoverInterface {
* Developers can pass a mouse, touch, or pointer event
* to position the popover relative to where that event
* was dispatched.
*
* @param event The event to position the popover relative to.
*/
@Method()
async present(event?: MouseEvent | TouchEvent | PointerEvent | CustomEvent): Promise<void> {
Expand Down Expand Up @@ -540,15 +542,14 @@ export class Popover implements ComponentInterface, PopoverInterface {

/**
* Dismiss the popover overlay after it has been presented.
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
*
* @param data Any data to emit in the dismiss events.
* @param role The role of the element that is dismissing the popover. For example, 'cancel' or 'backdrop'.
* @param role The role of the element that is dismissing the popover. For example, `cancel` or `backdrop`.
* @param dismissParentPopover If `true`, dismissing this popover will also dismiss
* a parent popover if this popover is nested. Defaults to `true`.
*
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
*/
@Method()
async dismiss(data?: any, role?: string, dismissParentPopover = true): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion core/src/components/reorder-group/reorder-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export class ReorderGroup implements ComponentInterface {

/**
* Completes the reorder operation. Must be called by the `ionItemReorder` event.
*
* If a list of items is passed, the list will be reordered and returned in the
* proper order.
*
Expand Down
1 change: 1 addition & 0 deletions core/src/components/router/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export class Router implements ComponentInterface {
*
* @param path The path to navigate to.
* @param direction The direction of the animation. Defaults to `"forward"`.
* @param animation A custom animation to use for the transition.
*/
@Method()
async push(path: string, direction: RouterDirection = 'forward', animation?: AnimationBuilder) {
Expand Down
2 changes: 0 additions & 2 deletions core/src/components/searchbar/searchbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,8 @@ export class Searchbar implements ComponentInterface {
/**
* Sets focus on the native `input` in `ion-searchbar`. Use this method instead of the global
* `input.focus()`.
*
* Developers who wish to focus an input when a page enters
* should call `setFocus()` in the `ionViewDidEnter()` lifecycle method.
*
* Developers who wish to focus an input when an overlay is presented
* should call `setFocus` after `didPresent` has resolved.
*
Expand Down
9 changes: 4 additions & 5 deletions core/src/components/toast/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,16 +397,15 @@ export class Toast implements ComponentInterface, OverlayInterface {

/**
* Dismiss the toast overlay after it has been presented.
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
*
* @param data Any data to emit in the dismiss events.
* @param role The role of the element that is dismissing the toast.
* This can be useful in a button handler for determining which button was
* clicked to dismiss the toast.
* Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
*
* This is a no-op if the overlay has not been presented yet. If you want
* to remove an overlay from the DOM that was never presented, use the
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
* Some examples include: `"cancel"`, `"destructive"`, `"selected"`, and `"backdrop"`.
*/
@Method()
async dismiss(data?: any, role?: string): Promise<boolean> {
Expand Down
Loading