Skip to content

Conversation

@MaxLee-dev
Copy link
Contributor

@MaxLee-dev MaxLee-dev commented Dec 19, 2025

Summary

  • Add typography and foreground props to Field.Label component for customizable styling
  • Default values: typography='body2', foreground='normal-100' (matches previous hardcoded behavior)
  • Remove hardcoded typography and foreground styles from CSS, apply dynamically via props instead

Changes

  • field.tsx: Add typography and foreground props with TypeScript types
  • field.css.ts: Simplify label style to only contain layout properties

Usage

<Field.Label typography="subtitle1" foreground="primary-100">
  Custom Styled Label
</Field.Label>

@changeset-bot
Copy link

changeset-bot bot commented Dec 19, 2025

🦋 Changeset detected

Latest commit: 6163f62

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@vapor-ui/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Dec 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
vapor-ui Ready Ready Preview, Comment Jan 8, 2026 4:51am

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @MaxLee-dev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Field.Label component by introducing new props for controlling its typography and foreground color. This change shifts styling responsibilities from static CSS to dynamic component props, offering greater flexibility and reusability for developers while maintaining the existing default visual presentation.

Highlights

  • Customizable Styling: The Field.Label component now accepts typography and foreground props, allowing for dynamic and customizable styling of its text appearance.
  • Default Behavior Preservation: The new typography and foreground props default to 'body2' and 'normal-100' respectively, ensuring that the component's appearance remains consistent with its previous hardcoded styling.
  • CSS Cleanup: Hardcoded typography and foreground styles have been removed from field.css.ts, simplifying the CSS and centralizing styling logic within the component itself.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이 PR은 Field.Label 컴포넌트에 typographyforeground prop을 추가하여 스타일을 동적으로 설정할 수 있도록 개선했습니다. CSS에서 하드코딩된 스타일을 제거하고, props를 통해 유연하게 제어할 수 있게 된 점이 좋습니다. 코드 가독성과 일관성을 높이기 위해 import 구문을 정리하고, prop 이름 충돌을 해결하는 더 나은 방법을 제안했습니다.

Comment on lines 8 to 10
import type { Foregrounds } from '~/styles/mixins/foreground.css';
import { foregrounds } from '~/styles/mixins/foreground.css';
import { type Typography, typography } from '~/styles/mixins/typography.css';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

import 구문의 일관성을 개선하고, typography 함수와 prop 이름의 충돌을 해결하기 위해 다음을 제안합니다.

  1. foregroundsForegrounds 타입을 하나의 import 구문으로 합칩니다.
  2. typography 함수를 typographyRecipe와 같이 alias하여 prop과의 이름 충돌을 피합니다.
Suggested change
import type { Foregrounds } from '~/styles/mixins/foreground.css';
import { foregrounds } from '~/styles/mixins/foreground.css';
import { type Typography, typography } from '~/styles/mixins/typography.css';
import { type Foregrounds, foregrounds } from '~/styles/mixins/foreground.css';
import { type Typography, typography as typographyRecipe } from '~/styles/mixins/typography.css';
References
  1. 스타일 가이드 3.1.2는 외부 패키지에 대한 네임스페이스 사용을 권장하지만, 이 원칙을 적용하여 내부 모듈에서도 as 키워드로 이름 충돌을 해결하고 코드 명확성을 높일 수 있습니다. (link)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To maintain consistency with the Text Component and typography, it seems unnecessary to modify it.

Comment on lines 35 to 52
const {
typography: typographyStyle = 'body2',
foreground = 'normal-100',
className,
...componentProps
} = resolveStyles(props);

return (
<BaseField.Label ref={ref} className={clsx(styles.label, className)} {...componentProps} />
<BaseField.Label
ref={ref}
className={clsx(
styles.label,
typography({ style: typographyStyle }),
foregrounds({ color: foreground }),
className,
)}
{...componentProps}
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

앞선 제안에 따라 typography 함수를 typographyRecipe로 alias했다면, 더 이상 prop 이름을 변경할 필요가 없습니다. 코드를 다음과 같이 간소화할 수 있습니다.

Suggested change
const {
typography: typographyStyle = 'body2',
foreground = 'normal-100',
className,
...componentProps
} = resolveStyles(props);
return (
<BaseField.Label ref={ref} className={clsx(styles.label, className)} {...componentProps} />
<BaseField.Label
ref={ref}
className={clsx(
styles.label,
typography({ style: typographyStyle }),
foregrounds({ color: foreground }),
className,
)}
{...componentProps}
/>
const {
typography = 'body2',
foreground = 'normal-100',
className,
...componentProps
} = resolveStyles(props);
return (
<BaseField.Label
ref={ref}
className={clsx(
styles.label,
typographyRecipe({ style: typography }),
foregrounds({ color: foreground }),
className,
)}
{...componentProps}
/>
);

@vapor-ui
Copy link
Collaborator

vapor-ui commented Dec 19, 2025

All tests passed!

Tests Passed Failed Duration Report
144 144 0 1m 4s Open report ↗︎

Click here if you need to update snapshots.

Add typography and foreground props to Field.Label.
Comment on lines 35 to 40
const {
typography: typographyStyle = 'body2',
foreground = 'normal-100',
className,
...componentProps
} = resolveStyles(props);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other components manage default values for variants in their .css.ts files. So I did some digging to remove the variant defaults defined in Field.Label's .tsx.

First, I considered importing the typography recipe from field.css.ts and directly composing a new recipe. However, since the existing recipe only returns a class name, this approach seems impossible.

The second method involves exporting only the variants object from the typography.css.ts file. Technically, this approach seems feasible.

// typography.css.ts
export const typographyVariants = {
    display1: layerStyle('components', {
        lineHeight: vars.typography.lineHeight['1000'],
        letterSpacing: vars.typography.letterSpacing['400'],
        fontSize: vars.typography.fontSize['1000'],
        fontWeight: vars.typography.fontWeight[800],
    }),

    // ...
};

export const typography = recipe({
    defaultVariants: { style: 'body1' },
    variants: {
        style: typographyVariants,
    },
});

// field.css.ts
export const label = recipe({
    defaultVariants: { foreground: 'normal-200', typography: 'body1' },
    variants: {
        foreground: foregroundVariants,
        typography: typographyVariants,
    },
});

This approach seems like it would completely separate style concerns from the React component file. However, since it involves passing variants back and forth, it doesn't feel 100% intuitive, so it might be good to discuss this together!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For each typo, values were created as objects and exported so they could be used in the recipe declaration of the component where they are actually used.

},
});

export type ForegroundVariants = typeof foregroundVariants;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious. What purpose is this type being exported for??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had intended to specify the type of props to be passed to Field.Label, but since I added it using the RecipeVariants<> utility type, it seemed unnecessary and I removed it.

@MaxLee-dev MaxLee-dev merged commit 61c606a into main Jan 8, 2026
9 of 10 checks passed
@MaxLee-dev MaxLee-dev deleted the feat/field-typography-foreground-props branch January 8, 2026 04:50
@github-actions github-actions bot mentioned this pull request Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants