Skip to content

Commit 8e249f0

Browse files
authored
[UI components]: 2024-04 Docs patch (#2112)
* scrollTo docs patch * changeset * style helper docs
1 parent b375a32 commit 8e249f0

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

.changeset/spicy-spoons-bake.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@shopify/ui-extensions-react': patch
3+
'@shopify/ui-extensions': patch
4+
---
5+
6+
ScrollView scrollTo docs changes

packages/ui-extensions/src/surfaces/checkout/components/ScrollView/ScrollView.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,23 @@ export interface ScrollViewProps
5656
*/
5757
direction?: 'block' | 'inline';
5858
/**
59-
* Scroll to a specific position or to an element.
59+
* Scroll to a specific position or to an element when the component is first rendered.
60+
*
61+
* This property allows you to set an initial scroll position or scroll to a specific element
62+
* when the `ScrollView` component mounts. Note that this action will only be performed once,
63+
* during the initial render of the component.
64+
*
65+
* @example
66+
* // Scroll to 100 pixels from the top on initial render
67+
* <ScrollView scrollTo={100} />
68+
*
69+
* // Scroll to a specific element on initial render
70+
* const elementRef = useRef(null);
71+
* <ScrollView scrollTo={elementRef.current} />
72+
*
73+
* @note
74+
* This property will only take effect on the first render. Subsequent updates to this property
75+
* will not trigger additional scroll actions.
6076
*/
6177
scrollTo?: number | HTMLElement;
6278
/**

packages/ui-extensions/src/surfaces/checkout/style/types.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,21 @@ export interface ConditionalStyle<
109109

110110
/**
111111
* A type that represents a value that can be a conditional style.
112-
* We highly recommend using the Style helper which simplifies the creation of conditional styles.
112+
* We highly recommend using the `Style` helper which simplifies the creation of conditional styles.
113+
*
113114
* To learn more check out the [conditional styles](/api/checkout-ui-extensions/components/utilities/stylehelper) documentation.
114115
*/
115116
export type MaybeConditionalStyle<
116117
T,
117118
AcceptedConditions extends BaseConditions = Conditions,
118119
> = T | ConditionalStyle<T, AcceptedConditions>;
119120

121+
/**
122+
* A type that represents a value that can be a conditional style. The conditions are based on the viewport size.
123+
* We highly recommend using the `Style` helper which simplifies the creation of conditional styles.
124+
*
125+
* To learn more check out the [conditional styles](/api/checkout-ui-extensions/components/utilities/stylehelper) documentation.
126+
*/
120127
export type MaybeResponsiveConditionalStyle<T> =
121128
| T
122129
| ConditionalStyle<T, ViewportSizeCondition>;

0 commit comments

Comments
 (0)