'use client';

import * as React from 'react';
import { SelectContext } from './SelectContext';

export default function SelectValue({ placeholder }: { placeholder?: string }) {
  const context = React.useContext(SelectContext);
  if (!context) {
    throw new Error('SelectValue must be used within Select');
  }

  return <span>{context.value || placeholder}</span>;
}
