<!--
title: Use concise methods
domain: app-frameworks
topic: Code Style
language: Other
source: shadcn-ui/ui
updated: 2024-02-22
url: https://awesomereviewers.com/reviewers/ui-use-concise-methods/
-->

Prefer built-in methods and properties that achieve the same result with less code. This improves readability, reduces potential bugs, and makes your code more maintainable.

For DOM manipulations, use specialized methods like `classList.toggle()` instead of conditional add/remove operations:

```javascript
// Instead of this:
document.documentElement.classList[isDark ? 'add' : 'remove']('dark');

// Use this more concise approach:
document.documentElement.classList.toggle('dark', isDark);
```

Similarly, avoid redundant styling properties when fewer properties can achieve the desired effect. Review your CSS classes to eliminate unnecessary declarations that don't contribute to the intended visual outcome:

```tsx
// Instead of potentially redundant classes:
<SheetContent className="w-[400px] sm:w-[540px] sm:max-w-none">

// Use only what's necessary:
<SheetContent className="w-[400px] sm:w-[540px]">
```

These simplifications make code easier to read and maintain while reducing the possibility of conflicting declarations.
